Laravel 5.3 requires PHP 5.6 or greater

Since the release of Laravel 5.3 I’ve seen a few people asking about the following error:

This suggests that Laravel is being launched via PHP 5.5 or below. Laravel 5.3 requires PHP 5.6 or greater. PHP 5.6 introduces the splat operator which allows for arrays and traversable objects to be unpacked in to argument lists. Example as provided by the PHP release notes:

The splat operator is represented by the three dots. It takes the two values in the array and feeds them in to the add function fulfilling the three parameters it requires.

Laravel 5.3’s code base makes wide use of this new operator along with other new language features. If you need to support older versions of PHP you will need to revert to previous versions of Laravel. Laravel 5.1 supports PHP 5.5.

Forcing HTTPS in Laravel 5.3

There is now a general consensus that offering your all of your content over an encrypted connection is a positive step in protecting your visitors. Google even offer a small ranking bump for sites that are entirely available over HTTPS.

In Laravel 5 it has been pretty easy to set this up thanks to the wonders of middleware. To get this going you could simply create a new file containing a middleware class in the app/Http/Middleware directory, then reference this from your app/Http/Kernel.php file.

For example, create the following class in app/Http/Middleware:

Once our HttpsRedirect class is created we can reference it in our Kernel.php file. Since Laravel 5.3 we have a new web group in this file. This is a minor change since 5.2 where you would append the reference to the protected $middleware array. In Laravel 5.3 every piece of middleware in the web group array is included on each and every request. This means that the above function would be applied to every route in the application. This is helpful as we’d like all our pages to be accessed over HTTPS.

app/Http/Kernel.php modification:

That’s it!

Laravel Homestead 4.0 released with support for PHP 7.1

Today sees the release of Laravel Homestead 4.0. Homestead is the seriously useful Vagrant box that gives you a Laravel development environment that’s ready to roll with the latest Laravel tools and dependencies. This release brings support for PHP 7.1 mere days after the official release by the PHP development team.

Notes are provided in theĀ release announcement over on the Laravel blog. The post describes how to upgrade to the latest and greatest.