This is how I upgraded my Laravel 5.4 app to Laravel 9 without upgrading to the versions in between.

Photo by Karolina Grabowska from Pexels

Step 1:

Back up composer.json file and delete vendor directory. Also remove composer-lock.json file.

Step 2:

Replace the "laravel/framework" version with the latest version, example "^8.*", make sure you remove all other dependencies in composer.json file. But leave them available in the backup file. Then run composer install.

Step 3:

Start to install each one of the dependencies from the back up composer.json file one by one, using the command "composer install", without the version, in that way, you let composer choose an appropriate package according to your new Laravel version.

Finally:

The hard part, you can either check what has changed in the new package version, in terms of deprecated and obsolete classes, modified and changed methods, etc. Or you can run your application and start fixing one by one of the errors that come up. Which will most likely be due to the change in package version.

You are done!