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.
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.
You should be performing your updates locally. Never update directly on production.
-
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.
-
Make sure all Composer dependencies are up to date by running
composer update
.composer update -
Run a
git commit
to start a clean slate.git commit -am "Updated Composer dependencies" -
Download a zip of a fresh
statamic/statamic
site.
Head to the 3.2.7 GitHub release, downloadSource code (zip)
, and unzip it somewhere on your computer. -
Delete (or move to another folder, or the trash)
app
,bootstrap
,config
,routes
,composer.json
, andartisan
. -
Copy
app
,bootstrap
,config
,routes
,composer.json
, andartisan
from the zip into your project. -
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/*
- Anything custom, like a Modifier or Controller, you may have added to the
-
Update your dependencies again now that you have an updated
composer.json
.composer update -
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.