Tech Post

How to update laravel project with latest version step by step guide

Updating a Laravel project to the latest version involves multiple steps depending on the version you’re starting from and upgrading to. Here’s a general step-by-step guide to upgrade a Laravel application to the latest version (e.g., from Laravel 10 to Laravel 11):

Laravel Upgrade Step-by-Step Guide

1. Check Current Version

php artisan --version

2. Review Official Upgrade Guide

Visit the official Laravel upgrade guide for the version you’re upgrading to:
🔗 https://laravel.com/docs/11.x/upgrade


3. Backup Your Project

Before making any changes:

  • Backup the codebase.
  • Backup your .env file.
  • Backup the database.

4. Update PHP Version

Check the Laravel version requirements:

  • Laravel 11 requires PHP >= 8.2.

Update your local environment and server accordingly.


5. Update Dependencies in composer.json

In your composer.json file:

Example from Laravel 10 to 11:

Change:

"laravel/framework": "^10.0"

To:

"laravel/framework": "^11.0"

Also update other related packages:

jsonCopyEdit"php": "^8.2",
"laravel/sanctum": "^4.0",
"laravel/tinker": "^2.8"

6. Update Composer Packages

Run:

composer update

If conflicts appear, resolve them manually or use:

composer update --with-all-dependencies

7. Handle Breaking Changes

Read the upgrade guide carefully and handle breaking changes in:

  • Middleware (Laravel 11 has a new middleware structure)
  • Route definitions
  • Config files (compare with fresh install)
  • Model casting, factories, events, etc.
  • Blade templates or component changes

8. Update Configuration and Files

Run:

php artisan vendor:publish --tag=laravel-config --force

Then compare your config files with a fresh Laravel 11 app to see new changes.

Use tools like Laravel Shift Blueprint or beyondcode/laravel-dump-server for quick insights.


✅ 9. Update Frontend Dependencies (if needed)

If you’re using Laravel Mix, Vite, or Tailwind, update your package.json:

npm install
npm run dev

✅ 10. Run Migrations & Tests

php artisan migrate
php artisan test

Test the entire application, including:

  • Authentication
  • APIs
  • Console commands
  • Scheduled tasks
  • Queues

11. Clear Caches

php artisan config:clear
php artisan route:clear
php artisan cache:clear
php artisan view:clear

12. Optional: Upgrade to Laravel Starter Kit (e.g., Breeze or Jetstream)

If you’re using Laravel Breeze or Jetstream, upgrade them too:

composer require laravel/breeze --dev
php artisan breeze:install
npm install && npm run dev

🧠 Tips

  • Use a Git branch for your upgrade (e.g., upgrade/laravel-11).
  • Upgrade in a staging environment before production.
  • Use Laravel Shift for automated upgrades if preferred.
  • Check the Laravel Upgrade Guide archive for version-specific instructions.

Also Read :- How to migrate old Flutter project to the latest Flutter version

Leave a Reply

Your email address will not be published. Required fields are marked *