Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

SarahS's avatar
Level 12

Upgrade a site from Laravel 8

I need to upgrade a site. It's currently in Laravel 8. Should I go to 9 first or migrate straight to 10?

0 likes
5 replies
LaryAI's avatar
Level 58

When upgrading a Laravel application, it's generally recommended to upgrade to each major version sequentially. This is because each major version may include breaking changes, deprecations, and new features that need to be addressed individually. Upgrading one major version at a time allows you to handle these changes more effectively and ensures that you don't miss any important upgrade steps.

As of my knowledge cutoff in early 2023, Laravel 10 has not been released. Laravel 9 is the latest major version. Therefore, you should upgrade your Laravel 8 application to Laravel 9. Once Laravel 10 is released, you can then consider upgrading from 9 to 10 following the same process.

Here are the general steps you would take to upgrade from Laravel 8 to Laravel 9:

  1. Read the Upgrade Guide: Before starting the upgrade process, read the Laravel upgrade guide thoroughly to understand the changes and deprecations.

  2. Update PHP Version: Laravel 9 requires PHP 8.0 or higher. Make sure your server environment is updated to a compatible PHP version.

  3. Update Composer.json: Change the Laravel framework version constraint in your composer.json file to ^9.0.

"require": {
    "php": "^8.0",
    "laravel/framework": "^9.0",
    // ...
},
  1. Update Dependencies: Update other composer dependencies if necessary. Some packages might need to be updated to versions that are compatible with Laravel 9.

  2. Run Composer Update: Run composer update to update your dependencies. This will install the new Laravel 9 framework files.

composer update
  1. Review All Changes and Upgrade Guide: Go through the changes that have been made and ensure that your codebase is compatible with Laravel 9. This includes updating your code to use any new features and to avoid using any features that have been removed or deprecated.

  2. Test Your Application: Thoroughly test your application to make sure everything is working as expected. It's a good idea to have a suite of automated tests that can help you identify issues quickly.

  3. Check Third-Party Packages: Ensure that any third-party packages you are using are compatible with Laravel 9. You may need to update some packages or find alternatives if they are not compatible.

  4. Deploy to a Staging Environment: Before deploying the upgrade to production, deploy it to a staging environment to perform further testing.

  5. Upgrade Production: Once you are confident that your application is working correctly on Laravel 9, you can proceed to update your production environment.

Remember to check the Laravel upgrade guide for any additional specific instructions or steps that may be required for your application. It's also a good idea to make a backup of your application and database before starting the upgrade process.

gych's avatar

If you follow the right guide you can migrate straight to laravel 10

Check for guides to migrate from laravel 8 to 10, there are multiple available on the internet.

If you want to migrate to laravel 9 first and then to laravel 10 you can use the guides from the official Laravel docs

martinbean's avatar
Level 80

@sarahs You should always upgrade version to version, so upgrade to 9, and then to 10.

The reason being, there may be changes in 9.x that 10.x is expecting. If you just tried going straight from 8.x to 10.x, then you may start getting unexpected errors with missing or changed files, mismatch in third-party package versions, etc.

1 like
SarahS's avatar
Level 12

@martinbean That was what I was thinking, it might take a bit longer (assuming all goes well) but I'm more likely to avoid errors I think.

1 like

Please or to participate in this conversation.