Upgrade from Laravel 7 to 8

A quick guide for upgrading from Laravel 7 to 8.

On a fundamental level, a Statamic website is a Laravel application with Statamic installed into it. When you upgrade Statamic, you're just upgrading Statamic — Laravel is not automatically upgraded at the same time.

Major Statamic releases may require newer versions of Laravel, which result in the need to upgrade the Laravel side of the application. There are many benefits to staying up to date with the latest versions of Laravel — security, performance, and compatibility with a wider range of Composer packages to name a few.

Disclaimer

This guide is intended for "stock" Statamic sites.

That is, a site where you installed Statamic and haven't added or customized functionality on the Laravel side of the application (typically the /app/ directory).

If you've added custom functionality, this guide will still be helpful, just be mindful of anything you may have added or modified and be sure to account for it.

Another Disclaimer

You should be performing your updates locally. Never update directly on production.

  1. First, your site should be version controlled with Git. These steps assume you'll be able to look at a git diff to make sure you don't remove important changes, dependencies, or routes.

  2. Make sure all Composer dependencies are up to date by running composer update.

    composer update
  3. Run a git commit to start a clean slate.

    git commit -am "Updated Composer dependencies"
  4. Download a zip of a fresh statamic/statamic site.
    Head to the 3.2.7 GitHub release, download Source code (zip), and unzip it somewhere on your computer.

  5. Delete (or move to another folder, or the trash) app, bootstrap, config, routes, composer.json, and artisan.

  6. Copy app, bootstrap, config, routes, composer.json, and artisan from the zip into your project.

  7. Look through the Git changes to see if anything was removed that you wanted to keep. For example:

    • Anything custom, like a Modifier or Controller, you may have added to the app directory
    • Configuration values you may have changed in the config directory
    • Additional dependencies in composer.json
    • Custom routes you may have configured in routes/*
  8. Update your dependencies again now that you have an updated composer.json.

    composer update
  9. Give your site a thorough test. For most sites, that'll do it!

If your site is more complex or is part of a larger Laravel Application, you can follow the Laravel Upgrade guide or use Laravel Shift to automate the upgrade for you.

Docs feedback

Submit improvements, related content, or suggestions through Github.

Betterify this page →