,

How to upgrade you Laravel project in Laravel 10 version?

Posted by

Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

In this article I’m going to share my learnings related to Laravel Projects.

For every new major version, Laravel’s documentation usually contains a comprehensive upgrading instruction. To understand the changes and any potential concerns with backward compatibility, make sure you read everything through completely.

Prerequisites:

  • Backup: Before moving on, make a complete backup of your project’s files, database, and any dependencies.
  • PHP Compatibility: Verify that the minimal PHP version required by Laravel 10 (8.0) is met by your system.
  • Local Development Environment: Prior to delivering the update to production, set up a local development environment for testing.

What are the Steps?

  1. Update Composer: To update Composer itself to the most recent version, run composer update.
  2. Update composer.json :
    • Open composer.json
    • Replace laravel/framework with ~10.0.0 (or ~10.0 for specific compatibility) inside the need section.
    • Update additional Laravel-related dependencies to the most recent compatible versions (e.g., doctrine/dbal, laravel/sanctum, spatie/laravel-ignition, and laravel/passport).
    • Take into account any additional optional dependencies that are necessary for your project.
  3. Database Migrations:
    • For information on possible database schema changes, see the Laravel 10 upgrade guide at https://laravel.com/docs/10.x/upgrade
    • To implement any required database migrations, run php artisan migrate.
  4. Configure New Features (Optional):
    • If you want to take advantage of the new Laravel 10 capabilities, check out Livewire (real-time updates), Inertia.js (front-end framework integration), and Laravel Scout (full-text search and aggregations).
    • For detailed setup instructions, refer to the official manual.
  5. Clean Cache and Generate Assets:
    • Clear the cache: php artisan cache:clear.
    • Generate assets: php artisan optimize.
  6. Unit and Integration Tests:
    • Use unit and integration tests to thoroughly test the features, core functioning, and edge cases of your project.
    • In Laravel 10, make necessary changes or add additional tests to make sure everything functions as it should.

Make sure your project files, database, and dependencies are completely backed up before updating your Laravel project to version 10. Verify that the version of PHP you are using satisfies the 8.0 minimum requirement and create a local development environment before testing. Update Composer first, then make the necessary changes to your composer.json file to need Laravel 10, then update any other dependencies linked to Laravel to the most recent compatible versions. Examine any modifications to the database schema described in the Laravel 10 upgrade guide, and perform database migrations as necessary. Optionally, build up additional features like Laravel Scout, Inertia.js, or Livewire. You can also use Artisan commands to create assets and empty the cache. Use unit and integration tests to thoroughly evaluate the functionality of your project, then think about releasing it to production and keeping a careful eye out for any problems.

Follow the official upgrading guide, update version by version if required, utilize version control, and seek support from the community.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x