Smooth Upgrade Guide: Laravel 10.x to Laravel 11.x

Laravel v10.x to Laravel v11.x

Are you ready to take your Laravel application to the next level with Laravel 11? This comprehensive guide will walk you through the upgrade process step by step, ensuing a seamless transition and leveraging the latest features and improvements. Let's dive in!

Why Upgrade to Laravel 11?

Laravel 11 brings exciting new features, performance enhancements, and bug fixes, providing a more robust and efficient framework for your application. By upgrading, you'll stay up to date with the latest developments in the Laravel ecosystem, ensuring your project remains secure and future-proof.

Pre-Upgrade Preparation

Before diving into the upgrade process, make sure to back up your project files and database to avoid any data loss or unforeseen issues. Once you've secured your data, let's proceed with the upgrade steps.

Step 1: Upgrade Composer Dependencies

Start by updating your composer.json file with the following changes:

Json

Copy code

“require”: {

“php” : “^8.2”

“guzzlehttp/guzzle” : “^7.2”

“laravel/freamework” : “^11.0”

“laravel/tinker”: “^2.8”

}

"require-dev": {
"fakerphp/faker": "^1.9.1",
"laravel/breeze": "^2.0",
"laravel/pint": "^1.0",
"laravel/sail": "^1.18",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^8.0",
"phpunit/phpunit": "^10.0",
"spatie/laravel-ignition": "^2.0"
}
Ensure that you replace existing packages with their updated versions as specified.

Step 2: Update Installed Packages (Optional)
If you have any of the specified packages installed, update their versions accordingly:
       laravel/breeze to ^2.0
       laravel/cashier to ^15.0
       laravel/dusk to ^8.0
       laravel/jetstream to ^5.0
       laravel/passport to ^12.0
       laravel/sanctum to ^4.0
       laravel/spark-stripe to ^5.0
       laravel/telescope to ^5.0
       inertiajs/inertia-laravel to ^1.0

Step 3: Run Composer Update
Execute the following command in your terminal to update your dependencies:
Bash
Copy code
composer update

This will download and install the latest versions of the packages specified in your composer.json.

Step 4: Publish Sanctum Migrations
If you're using Laravel Sanctum, run the following command to publish its migrations:
Bash
Copy code
php artisan vendor:publish --tag=sanctum-migrations

Step 5: Publish Additional Package Migrations (Optional)
If you have any of the following packages installed, publish their migrations as well:
Bash
Copy code
php artisan vendor:publish --tag=cashier-migrations (if installed)
php artisan vendor:publish --tag=passport-migrations (if installed)
php artisan vendor:publish --tag=spark-migrations (if installed)
php artisan vendor:publish --tag=telescope-migrations (if installed)

Conclusion
Congratulations! You've successfully upgraded your Laravel application from version 10 to version 11. Enjoy the benefits of the latest features and enhancements, and don't forget to explore the Laravel documentation for further insights and optimizations.
Happy coding!
 

 

 

 

Share Links:

Comments:

Comment here: