Updating Laravel from v5.1 to v5.5

So the new long-term support version of Laravel has been released taking us from the last long-term support version v5.1 to v5.5 with all the improvements that brings, however while there is plenty of guides around for upgrading from v5.4 to v5.5 there are none for upgrading from v5.1 straight to v5.5 unless you painstakingly upgrade to every version in between.

But don’t worry I have already been doing the upgrades to our current projects in house and have put together a guide that will allow you to upgrade a Laravel project from v5.1 to v5.5.

As a disclaimer however this guide is only for simple Laravel projects and may not work with projects that contain more complex aspects of Laravel such as “queues” and “events”.

So lets get started.

1) In your composer.json set the Laravel version to laravel/framework": "5.5.* add symfony/dom-crawler: "3.1.* and symfony/css-selector": "3.1.*
and finally update the phpunit version to ~6.0.

2) Next we need to completly replace our config/auth.php file with the one found here.

Once you have replaced the file with a fresh copy, set your authentication configuration options to their desired value based on your old configuration file. If you were using the typical, Eloquent based authentication services available in Laravel 5.1, most values should remain the same.

You should also take special note of the passwords.users.email configuration option in the new auth.php configuration file and verify that the view path matches the actual view path for your application, as the default path to this view was changed in Laravel 5.2. If the default value in the new configuration file does not match your existing view, update the configuration option.

3) In your App\Exceptions\Handler class file add the following use statements at the top

use Illuminate\Validation\ValidationException;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Symfony\Component\HttpKernel\Exception\HttpException;

and add them to the $dontReport array

protected $dontReport = [

4) In your config/app.php file remove both


from the providers array.

5) In the app/Providers/EventServiceProvider.php file remove the arguments provided for the boot method as well as the arguments provided for the parent::boot so it looks like the following.

  public function boot()

6) In the user class located at app/User.php add the use statement for the notifiable trait.

use Illuminate\Notifications\Notifiable;

7) Completely replace the the file app/Exceptions/Handler.php with the file found here.

8) In the app/http/Kernel.php file add the can and bindings middleware to the routeMiddleware array

        'can' => \Illuminate\Auth\Middleware\Authorize::class,
        'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,

9) Back in the config/app.php add the notificationsServiceProvider to the providers array


and add the Notifications facade to the aliases array`.


10) In the app/http/Kernel.php file, add the middlewareGroups array provided below.

 * The application's route middleware groups.
 * @var array
protected $middlewareGroups = [
    'web' => [
    'api' => [

11) If you don’t already have one create a routes folder on the root of your project and inside there create the files web.php and app.php.

12) Take the contents of your old routes.php folder and put it into the new web.php file, any old routes that are used for communication to APIs should be placed into the api.php file, if there are no API routes simply open PHP tags at the top of the api.php file <?php.

13) Replace the contents of the app/Providers/RouteServiceProvider.php file with the file found here.

And that’s it simply run a composer update and the artisan commands php artisan view:clear and ‘php artisan view:clear’ and everything should be upgraded to v5.5.