Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Freek Van der Herten:
Easily work with the Twitter Streaming API in PHP
Jan 16, 2017 @ 09:25:26

On his site ** has posted a tutorial showing you how to use the Twitter Streaming API from PHP with some help from the Phirehose package.

Twitter provides a streaming API with which you can do interesting things such as listen for tweets that contain specific strings or actions a user might take (e.g. liking a tweet, following someone,…). In this post you’ll learn an easy way to work with that API.

When researching on how to work with the streaming API in PHP it stumbled upon Phirehose. This package can authenticate and set up a connection with the streaming API.

Since the Phirehose API is a bit difficult to work with, he created a package (Laravel version) to help make it a bit easier. He then walks you through the integration of this service with a Laravel-based application, including showing you how to set up the app on the Twitter side and get the API key/secret for the connection. He shows how to add the Laravel package version's provider to the configuration and create a first stream type: listening for certain hashtags. He shows how the stream reacts to a simple tweet of his with the "#laravel" hashtag in a console application. He also includes another example showing a stream that listens for people performing actions on the current user's stream (like favoriting a tweet). You can find out more about the powerful Stream API in the official Twitter documentation for the service.

tagged: twitter streaming api tutorial package phirehose laravel

Link: https://murze.be/2017/01/easily-work-with-the-twitter-streaming-api-in-php/

SitePoint PHP Blog:
Voyager – Can an Admin UI Make Laravel Even More Approachable?
Jan 12, 2017 @ 09:23:37

On the SitePoint PHP blog they've posted an article from Claudio Ribero highlighting an administration UI specifically designed for Laravel applications: Voyager.

Voyager is a Laravel package that provides a full administration system for the framework in its “skeleton app” form. Voyager has 4 main features: Media Manager, Menu Builder, Database Manager and Bread/CRUD builder.

He first walks you through the process of getting a new Laravel application up and running then pulling in the tcp/voyager package. He shows how to update your app configuration to integrate it then install it. Once you've performed these steps you'll have a /admin portion of your site up and ready to go with the default login. With that all set up Claudio gets into the specifics for use of each of the components (listed above) in the package, including screenshots and code where helpful.

tagged: voyager administration interface laravel opensource tutorial

Link: https://www.sitepoint.com/voyager-can-an-admin-interface-make-laravel-even-more-approachable/

Medium.com:
Framework Code Complexity Comparison
Jan 10, 2017 @ 11:29:30

On Medium.com Taylor Otwell, lead developer and creator of the Laravel framework, has posted some results about framework code complexity based on his own research and information gathering.

Last week as I was refactoring and cleaning Laravel for the 5.4 release, Graham Campbell showed me some code complexity statistics for the framework. I decided to compare this against some other PHP frameworks to see how Laravel stacks up.

[...] I was pleased to see Laravel has the lowest average method complexity of any of the frameworks measured. In addition, Laravel does not contain any method longer than 13 lines of code. [...] The primary goal of this comparison is to compare how I personally write code vs. how other projects are writing code. All project’s measured have a large enough sample size of pure, first-party code to accurately measure that.

He then shares the cyclomatic complexity numbers for several different (and popular) frameworks in the PHP ecosystem:

  • Laravel
  • Symfony
  • Zend Framework
  • Cake
  • Slim

He also compares just the Eloquent ORM and the Doctrine ORM components. For each he provides stats like: lines of code, average method complexity and percentage of methods that are non-static. The results are interesting but most are pretty much expected (like the Slim microframework being lowest on several of the statistics mostly due to its size).

tagged: code complexity framework comparison laravel taylorotwell

Link: https://medium.com/@taylorotwell/measuring-code-complexity-64356da605f9#.j719oq8ue

DotDev.co:
Google ReCaptcha integration with Laravel
Jan 10, 2017 @ 09:26:28

On the DotDev.co site they've posted an article from Talevski Igor about integrating Google's ReCaptcha with Laravel for use in verifying forms and protecting them against automated attacks.

Today i have task to create ReCaptcha on contact form with in a Laravel Web page and I like to share the process of making this possible.

He then walks you through the process of getting the configuration you'll need for your domain and using this package to easily integrate it with Laravel and its forms. He adds the routes for both the GET and POST requests along with the matching view and controller. He then uses the env helper function to get the ReCaptcha key from the configuration and places it in the form. He also adds the "g-recaptcha-response" variable to the required values rules and creates a simple Guzzle HTTP client to make the request back to Google to verify the result.

tagged: recaptcha security laravel tutorial form integration package

Link: https://dotdev.co/google-recaptcha-integration-with-laravel-ad0f30b52d7d?gi=ec5b94e26a27#.qdpwauax0

Laravel News:
Seven Tips to Learn Laravel More Effectively
Jan 09, 2017 @ 10:25:17

For those out there wanting to learn more about the Laravel framework but weren't sure where to start, the Laravel News site has just the post for you. In this new guide they provide seven steps to help you learn about Laravel and its use more effectively.

As the community grows, there are many resources available to help you learn Laravel. That’s great! But, how do you choose the best one? Which will be the best use of your time to read or watch? For those new to the framework, I’m sure these questions are on your mind, here are seven tips to help you learn Laravel more effectively.

Some of these tips will be specific to Laravel, while others are more general for learning any programming language or framework.

Their steps start with some of the more foundational stuff like learning about Composer/OOP/PHP first before venturing into the framework at all. Then, with that knowledge under your belt, you can move on to the other steps: where to learn the most effectively (books, courses, videos, etc) and actually putting fingers to keys and start writing code. He makes recommendations about how to use Google and Stack Overflow to help you find what you need an, finally, the advice to find a mentor to learn from and to not give up even if you hit something difficult.

tagged: laravel effective top7 tips framework basics learning

Link: https://laravel-news.com/seven-tips-to-learn-laravel-more-effectively

Freek Van der Herten:
Using Varnish on a Laravel Forge provisioned server
Jan 05, 2017 @ 14:19:15

Freek Van der Herten has a post to his site showing you how to set up Varnish with a Laravel Forge server. Forge is a service that makes it simpler to set up and manage servers and the applications installed without having to mess with the details yourself.

For a project we’re working on at Spatie we’re expecting high traffic. That’s why we spent some time researching how to improve the request speed of a Laravel application and the amount of requests a single server can handle. There are many strategies and services you can use to speed up a site. In our specific project one of the things we settled on is Varnish. In this post I’d like to share how to set up Varnish on a Forge provisioned server.

He gives a high level overview of what Varnish is and what benefit it provides to your application (complete with illustrations) and includes a link to a presentation introducing Varnish to PHP developers. Then he moves on to installing Varnish on the server, updating the VCL configuration file and opening a port for you to use when connecting to the Varnish service. He shows the difference in the response headers when Varnish handles the response and the updates you'll need to make to get your Laravel application to play nicely with Varnish with this package.

He ends the post with examples of how to test the performance difference and some final steps to update the config and have it run on port 80 instead of the default 6081.

tagged: laravel forge varnish provision server tutorial setup configure performance

Link: https://murze.be/2017/01/varnish-on-a-laravel-forge-server/

Laravel News:
2016 Laravel Survey Results
Jan 05, 2017 @ 13:13:27

The Laravel News site has published the results from their latest survey of the Laravel ecosystem and feedback directly from developers using it (and other) technologies.

Back in September, we partnered with LaraJobs to run a Laravel survey to see what types of projects people are taking on with Laravel as well as get some feedback on what the Laravel community could be doing better. The results ended up with over 1,600 submissions and some interesting insights.

You can see the complete results on this 2016 Laravel Survey Results page and thanks for everyone who took the time to fill it out.

Questions answered in the survey results include:

  • What's the one reason why you selected Laravel over other frameworks?
  • How many production applications do you have using Laravel?
  • How many users does your largest Laravel based SaaS have?
  • Are you able to find the quantity and quality of Laravel developers you need?

For each question they've shared the results (bar charts) and provided a brief commentary along with a list of things people suggested as additions to the Laravel framework.

tagged: laravelnews laravel survey 2016 results

Link: https://laravel-news.com/2016-laravel-survey-results

Laravel News:
80 Laravel Tutorials, Packages, and Resources from 2016
Jan 02, 2017 @ 10:32:02

To start off the new year the Laravel News site has posted a list of 80 tutorials, packages and resources they've shared with the community over the past year.

As 2016 is coming to a close it’s a great time to look back on the year and see just how much progress has been made. Laravel had a busy year with 5.3 being released, Laracon, updates to all the components, and now gearing up for the Laravel 5.4 release.

To look back on the year I’ve put together a list of some of the hits of 2016 and arranged them by month so you can get a quick overview of all the highlights.

There's lots of good content posted here and it's interesting to see all of the developments in not only the Laravel community but also the wider PHP community (including the fifth birthday of Laravel in June). Check out the full post for the complete list and links to each post.

tagged: laravelnews laravel post list package tutorial resource 2016

Link: https://laravel-news.com/80-laravel-tutorials-packages-and-resources

Laravel News:
Laravel Dusk Is Coming to Laravel 5.4
Dec 28, 2016 @ 09:53:48

On the Laravel News site there's an announcement posted about a new tool coming to the Laravel ecosystem - Laravel Dusk. Dusk is a browser testing tool that makes it easier to test Laravel-based Javascript-heavy applications.

When you write end-to-end tests, Laravel provides a set of useful helper methods which make it easy to click a link, fill an input field, or submit a form. Under the hood, Laravel uses the Symfony BrowserKit component to simulate the behavior of the web browser. However, if your app uses JavaScript and AJAX to load the page, BrowserKit will not work for you.

Laravel Dusk is a new tool that will be introduced in Laravel 5.4 to solve this problem.

The post goes on to talk about the tool and what kind of functionality powers it - a combination of ChromeDriver and the Facebook PHP-Webdriver packages. The testing process is claimed to be faster than normal Selenium tests and feels more "natural" than BrowserKit testing. Dusk will save screenshots of failures automatically and comes with helper methods, multiple window support and a Dusk-specific environment file.

tagged: laravel dusk browser testing chromedriver webdriver tool ecosystem

Link: https://laravel-news.com/laravel-dusk-is-coming

Matt Stauffer:
Using Vue in Laravel 5.3, with the Vue bootstrap and sample component
Dec 23, 2016 @ 09:18:29

Matt Stauffer has posted the next article in his series of "What's New in Laravel 5.3" series with this article covering the use of Vue.js with Laravel and some of the bootstrapping that makes it easier.

In Laravel 5.3, it's easier than ever to write and use Vue components out of the box. This means 5.3 has a somewhat more opinionated default frontend stack than previous versions do. But never fear—it's easy to strip out the default components.

Let's explore 5.3's JavaScript stack together. Spin up a sample app using the Laravel installer (or, if you're like me, use Lambo) and open up the site in your favorite IDE.

He starts with the sample definitions of the package.json and Gulp files, including some dependencies including Vue.js itself and the Vue Resource packages. He then shows a sample app.js file to define the main part of the application and a matching bootstrap.js with a bit of, well, bootstrapping for the application. Finally he creates the example component, runs yarn/gulp and updates a Blade template to lay out the main application div and include the application Javascript file. Finally he shows what the resulting application should look like with screenshot included.

tagged: laravel vuejs tutorial introduction gulp yarn elixir javascript framework

Link: https://mattstauffer.co/blog/using-vue-in-laravel-5-3-with-the-vue-bootstrap-and-sample-component