Introduction:
Welcome to this quick guide, In the ever-evolving world of web development, staying up-to-date with the latest technologies and frameworks is crucial. Laravel, known for its elegant syntax and powerful features, is no exception. In this article, we'll guide you through the process of upgrading your Laravel 9 application to the shiny new Laravel 10, with a sprinkle of PHP 8.1 or greater. Let's get started.
Prerequisites:
- PHP 8.10 or greater
- composer 2.2.0
If your composer version is less than 2.2.0 run the following command to upgrade it.
This command ensures that you're using the latest version of Composer, a key player in orchestrating Laravel's dependencies.
Upgrading dependencies:
In you composer.json upgrade the following core dependencies to laravel 10 compatibality. Additionally, ensure your third-party dependencies align with the latest standards.
// Remove
"fruitcake/laravel-cors": "^2.0",
"facade/ignition": "^2.5",
// Update core
"php": ">=7.4.3 <=8.2.14",
"laravel/framework": "^10.43",
"laravel/sanctum": "^3.2",
"laravel/tinker": "^2.7",
"laravel/pint": "^1.1",
// Update all third-party dependencies along with these
"fakerphp/faker": "^1.19",
"mockery/mockery": "^1.5",
"nunomaduro/collision": "^6.2",
"phpunit/phpunit": "^10.1",
"spatie/laravel-ignition": "^2.0"
Stability is Key:
Set the minimum-stability to "stable" in your composer.json:
"minimum-stability": "stable",
This ensures that your project relies on stable packages, guaranteeing a reliable performance.
Composer update
with all the preparations done, let's take the center stage and run the following command:
composer update
This command executes the upgrade, fetching the latest versions of your dependencies and ensuring a seamless transition.
Conclusion:
that's it! You have successfully upgraded from laravel 9 to 10. Embrace the latest features, revel in the performance improvements.