Laravel 12 to 13 Upgrade Guide: Requirements, Breaking Changes and Order of Work
Shakewell ·
Laravel 13 was released on 17 March 2026, and Laravel’s release notes call it “a relatively minor upgrade in terms of effort”. Our Laravel upgrade guide for versions 9 to 13 covers every step and the support dates. This post is the narrow one: you are on Laravel 12 and want to know exactly what to check.
We read the official upgrade guide on 29 November 2026 and checked package requirements against each package’s own composer.json. Where the guide says nothing, we say so.
Requirements before you start
Laravel 13 needs PHP 8.3 or later and supports PHP 8.3 to 8.5. Laravel 12 supported PHP 8.2 to 8.5, so an application on 8.2 has a runtime upgrade to do first. PHP 8.2 reaches the end of its security fixes on 31 December 2026, which we cover in PHP 8.2 end of life. Treat the two as one piece of work.
Check PHP in every place the code runs. Cron, queue workers and deploy scripts do not always use the same binary as the website.
The guide asks you to update these in composer.json:
"require": {
"laravel/framework": "^13.0",
"laravel/tinker": "^3.0"
},
"require-dev": {
"laravel/boost": "^2.0",
"phpunit/phpunit": "^12.0",
"pestphp/pest": "^4.0"
}
Only change the entries you already have. Boost, PHPUnit and Pest are development tools, so skip any you do not use. Pest 4 requires PHP 8.3 or later. Pest 5 also exists and needs PHP 8.4, but the Laravel guide names Pest 4, so we stay there unless there is a reason to move.
If you use the Laravel installer to create new projects, update it too. Run composer global update laravel/installer, or update Laravel Herd if that is where your copy comes from.
High and medium impact changes
The guide ranks each change by likelihood of impact. These are the high and medium ones, with what we search for.
| Change | Impact | What the guide says | Search for |
|---|---|---|---|
| Dependency versions | High | Framework, Tinker, Boost, PHPUnit and Pest move to new majors | composer.json, plus composer why-not laravel/framework 13.0 |
| Laravel installer | High | Update it for Laravel 13 compatibility | Local machines and CI images |
| Request forgery protection | High | VerifyCsrfToken is renamed PreventRequestForgery and now verifies request origin using the Sec-Fetch-Site header |
VerifyCsrfToken, ValidateCsrfToken, withoutMiddleware in tests |
Cache serializable_classes |
Medium | The default cache config sets it to false, so cached PHP objects are not unserialized unless listed |
Cache::put, Cache::remember, Cache::forever storing models or objects |
upsert on MySQL or MariaDB |
Medium | An empty uniqueBy now throws InvalidArgumentException |
->upsert( calls with an empty second argument |
Request forgery protection
The old class names remain as deprecated aliases, so existing code keeps working. Rename direct references anyway, particularly where tests or routes exclude the middleware:
use Illuminate\Foundation\Http\Middleware\PreventRequestForgery;
->withoutMiddleware([PreventRequestForgery::class]);
The middleware configuration API also gains a preventRequestForgery(...) method. The guide does not list specific routes at risk. Because the middleware now checks where a request came from, we test any route that receives a post from another site, such as a payment return URL or an embedded form, instead of assuming it behaves as before.
Cache serializable_classes
The guide explains the reason: it hardens cache unserialization against PHP deserialization gadget chain attacks if your APP_KEY leaks. If your application deliberately caches objects, list the classes:
'serializable_classes' => [
App\Data\CachedDashboardStats::class,
],
The alternative is to cache arrays instead of objects, which the guide also suggests. This one can produce a quiet bug: a cached value that used to come back as an object may not. Search for every cache write that stores something other than a scalar or array.
upsert with MySQL or MariaDB
Those drivers ignore uniqueBy and use the table’s primary and unique indexes. Laravel 13 now validates it anyway. An empty value throws instead of generating invalid SQL, so any call that passes [] needs a real column list.
The low impact list
There are 14 low impact items in the guide’s body (its contents list shows 13), and several apply only if you use that feature. Check these on every upgrade:
- Session
serialization. The new skeleton setsjsoninconfig/session.php. If you sync config files and change an existingphpvalue, every active session is invalidated. Keepphpto retain sessions. The guide recommendsjsonfor security if you do not store PHP objects in the session and are happy to ask users to sign in again. - Cache and cookie prefixes. Default cache and Redis prefixes now use hyphens, for example
Str::slug(APP_NAME)followed by-cache-. This matters only if you rely on the framework fallback. SetCACHE_PREFIX,REDIS_PREFIXandSESSION_COOKIEexplicitly to keep the old names. - Global scopes in nested
whereclosures. CallingwithoutGlobalScopeinside a closure now removes the scope from the whole query. Queries can return rows they used to exclude, so check soft-delete and tenant scopes. - Queue events.
JobAttemptedexposes$exceptioninstead of$exceptionOccurred, andQueueBusyrenames$connectionto$connectionName. Search your listeners. array_first()andarray_last(). Laravel 13 depends onsymfony/polyfill-php85, which defines these functions on PHP below 8.5. They can collide withlaravel/helpersor your own globals. PreferIlluminate\Support\Arr.- Domain routes are now matched before non-domain routes, which changes precedence if you relied on registration order.
- Others: MySQL
DELETEwithJOIN,ORDER BYandLIMIT; polymorphic pivot table names;Container::callwith nullable defaults; managerextendcallbacks; Bootstrap pagination view names;Strfactories resetting between tests; and eager-loaded relations being restored when model collections are serialised.
Most of the very low items concern code that implements framework contracts, such as a custom cache store, queue driver or MustVerifyEmail implementation. Search for implements on those interfaces. A few cover model booting, Js::from output and scheduler timing, so skim that section. The default password reset email subject also changed to “Reset your password”, which matters if a test asserts the old text.
First-party and common packages
Laravel 13 is only as ready as your dependencies. This is what each package’s own composer.json allowed on 29 November 2026.
| Package | Version checked | Laravel 13 allowed | Note |
|---|---|---|---|
| Livewire | 3.8.12 and 4.4.10 | Yes | Both lines allow Laravel 10 to 13 |
| Filament | 3.3.59, 4.17.1 and 5.12.1 | Yes | Via filament/support; 4 and 5 need PHP 8.2 or later |
| Inertia (Laravel adapter) | 3.8.0 and 2.0.28 | Yes | 3.x needs Laravel 11.35 or later |
| Sanctum | 4.5.0 | Yes | 4.5.0 supports Laravel 12 and 13 only |
| Horizon | 5.52.0 | Yes | 5.52.0 supports Laravel 12 and 13 only |
| Pest | 4.7.8 | Not applicable | Requires PHP 8.3 and PHPUnit 12 |
| Tinker | 3.2.0 | Yes | Laravel 12 or 13 |
Packagist shows these constraints, but a constraint is not a test result. A package that allows Laravel 13 can still behave differently under it, so the test suite is the real check. For Laravel Nova, see the compatibility notes in our 9 to 13 guide.
The order we work in
- Move PHP to 8.3 or later on every environment, and run the Laravel 12 tests there first. This isolates runtime problems from framework ones.
- Get the tests green on Laravel 12. If coverage is thin, add tests around payments, logins, imports and queued jobs before changing anything.
- Bump the packages in
composer.json, then runcomposer update. Usecomposer why-not laravel/framework 13.0to find blockers. Decide early about abandoned packages. - Work through the table above, high and medium first, using the search terms. Then the low list, for the features you use.
- Review the config diff. The guide points to the
laravel/laravelrepository comparison between 12.x and 13.x. Take what you need, and decide on session serialisation deliberately. - Run it on staging with a copy of production data and the same PHP build, then deploy at a quiet time with a database backup and the previous release ready. Watch the logs, the queue and the scheduler afterwards.
None of these steps needs Laravel 13’s new features. The AI SDK, JSON:API resources, queue routing and the new PHP attributes are optional. Adopt them in separate changes so a failure points to one cause.
Shift and Boost: when each helps
The guide offers two shortcuts. Laravel Shift is a community-maintained service that automates Laravel upgrades. Laravel Boost is a first-party MCP server. Once it is installed in a Laravel 12 application, the /upgrade-laravel-v13 command starts a guided upgrade in Claude Code, Cursor, OpenCode, Gemini or VS Code, and it requires Boost ^2.0.
They can handle the mechanical part: renames, version bumps and config changes. They suit a conventional application with mainstream packages. They help less when the difficulty is elsewhere: a package with no Laravel 13 release, custom code that overrides framework classes, or a missing test suite. In those cases we treat their output as a draft branch that a person reviews and tests.
What about Laravel 14?
Laravel’s 13.x release notes name no Laravel 14 release date or feature list, so we have none to report. They do say major versions arrive every year, around the first quarter, and that Laravel tries to make a move to a new major possible “in one day or less”. Planning for one upgrade a year, as in our Laravel upgrade guide, is safer than planning around a date.
If the upgrade is not routine
A well-tested application on Laravel 12 with mainstream packages is usually a short job. An application several versions behind, with abandoned packages and no tests, is a project, and Laravel 12 stops receiving security fixes on 24 February 2027. We do both through our framework upgrades and Laravel development work, and our project rescue service covers applications nobody is sure how to change.
Sources: Laravel 13.x upgrade guide, Laravel 13.x release notes, Laravel Boost, Laravel Shift, and the package pages for Livewire, Filament, Inertia Laravel, Sanctum, Horizon, Pest and Tinker, checked 29 November 2026.
Common questions
What PHP version does Laravel 13 need?
Laravel 13 requires PHP 8.3 or later and supports PHP 8.3 to 8.5. If your Laravel 12 application runs on PHP 8.2, the runtime has to move first, and it has to move everywhere: the web server, the command line, queue workers and the scheduler.
How long does a Laravel 12 to 13 upgrade take?
Laravel's upgrade guide estimates 10 minutes, and its release notes say much of the release focus went on minimising breaking changes. That covers the framework only. Time goes on packages that have not released a Laravel 13 version, a thin test suite, and any code that touches the items listed in the guide. Run the steps on staging before you plan a date.
Which changes are likely to affect us?
The guide rates three as high impact: the Composer version bumps, the installer update and the rename of the CSRF middleware to PreventRequestForgery. Two are medium: the new cache serializable_classes option and stricter upsert validation on MySQL and MariaDB. Search your code for each of them before anything else.
Will upgrading log everyone out?
Only if you sync your session config with the new skeleton. The skeleton sets session serialization to json, and changing an existing application from php to json invalidates all active sessions. Keep the value as php to retain sessions, or change it and accept that users sign in again.
Should we use Laravel Shift or Laravel Boost?
Either can produce a first draft of the changes. Shift is a community-maintained service that automates Laravel upgrades. Boost is a first-party tool that gives your AI assistant a guided /upgrade-laravel-v13 command. Neither tells you which packages to keep or proves the application still behaves the same, so review and test the result.