How to upgrade Laravel?

Table of contents:

# Introduction

The official upgrade guide is a good starting point to upgrade the Laravel framework. It's a list of all changes in the framework. But it's not enough. You need to know what has changed in the skeleton application (e.g. configuration, migration, language, environment files). You need to know what has changed in the dependencies. The framework must also adapt to the changes in PHP and other dependencies (e.g. Symfony).

I created for you a collection of links to all resources that can help you upgrade your Laravel application. It's a collection of links to the official upgrade guides, release notes, and other resources that can help you upgrade your application and understand what has changed in the framework.

# Upgrade to Laravel 11 from 10

# Upgrade to Laravel 10 from 9

# Upgrade to Laravel 9 from 8

# Upgrade to Laravel 8 from 7

# Upgrade to Laravel 7 from 6

# Upgrade to Laravel 6 from 5.8

# Upgrade to Laravel 5.8 from 5.7

# Upgrade to Laravel 5.7 from 5.6

# Upgrade to Laravel 5.6 from 5.5

# Upgrade to Laravel 5.5 from 5.4

# Upgrade to Laravel 5.4 from 5.3

# Upgrade to Laravel 5.3 from 5.2

# Upgrade to Laravel 5.2 from 5.1

# Upgrade to Laravel 5.1 from 5.0

# Upgrade to Laravel 5.0 from 4.2

# Upgrade to Laravel 4.2 from 4.1

# Upgrade to Laravel 4.1 from 4.0

# Upgrade to Laravel 4.0 from 3.2

# Upgrade to Laravel 3.2.14 from 3.0

# Older versions <= 3.0

# Helpful tips

# Use Rector to automatically upgrade your code

Rector is a tool that can automatically upgrade your code. It's a good idea to use it before you start upgrading your code manually. It can save you a lot of time.

To upgrade Laravel with Rector you have to install the driftingly/rector-laravel package with Laravel sets of rules:

composer require driftingly/rector-laravel --dev

Then you have two options:

  • choose a one rule set for a specific version of Laravel
use RectorLaravel\Set\LaravelSetList;
use Rector\Config\RectorConfig;

return static function (RectorConfig $rectorConfig): void {
    $rectorConfig->sets([
        LaravelSetList::LARAVEL_100
    ]);
};
  • choose a rule set that has all rule sets from previous versions up to a specific version of Laravel:
use RectorLaravel\Set\LaravelLevelSetList;
use Rector\Config\RectorConfig;

return static function (RectorConfig $rectorConfig): void {
    $rectorConfig->sets([
        LaravelLevelSetList::UP_TO_LARAVEL_100
    ]);
};

# Update many Composer dependencies at once

When upgrading to the newest version of Laravel, you may need to update many of your dependencies because of version constraints in your composer.json file. If you want to update many Composer dependencies at once, you can add more packages to the Composer update command:

composer update laravel/sail laravel/tinker laravel/framework