Skip to the main content
{}
Back to all articles

Technical article

Upgrade Laravel 12 to Laravel 13: a controlled approach

Plan a Laravel 13 upgrade around framework changes, package compatibility, tests, configuration comparison, deployment and rollback.

By Codegenie2 minute read
  • Laravel & PHP
  • Upgrade
  • Laravel
  • controlled
  • approach
Code window, PHP versions and software management dashboard.
In this article

Upgrade Laravel 12 to 13 from the actual application and official upgrade guide. Check PHP and packages, determine which breaking changes affect your code, then validate the same release artifact on the target runtime. A successful dependency command is not a completed upgrade.

Start with runtime and dependencies

Laravel 13 requires at least PHP 8.3 according to the release notes. Also check extensions, CLI versus web PHP and the strictest package requirement. Inventory framework, authentication, Livewire, test tooling and internal packages. Use Composer to identify version blockers instead of bypassing requirements with ignore-platform-reqs.

Illustrative change matrix for an existing app

  • Direct VerifyCsrfToken references: review PreventRequestForgery and origin checking; test real form requests and custom exceptions.
  • Objects in cache: review serializable_classes or store explicit arrays; test old and new cache contents.
  • MySQL/MariaDB upsert with empty uniqueBy: supply the intended unique-key contract and verify the database index.
  • Reliance on default cache prefixes or session cookie names: check whether existing configuration fixes them already; plan any session transition.

These illustrate applicability, not an exhaustive list. Read the full guide and mark each item applicable, not applicable or unresolved, with the relevant code location. Do not copy a new skeleton over existing bootstrap and configuration files.

Work on a branch and keep the baseline

Run existing tests on Laravel 12 first. Then apply relevant constraints from the guide and review the lockfile diff. The commands below are part of that check; update used test packages for compatibility too. Build caches with safe test configuration. Remove generated configuration cache before packaging if it contains environment values.

Part of upgrade validation, not a complete scriptterminalbash
composer require laravel/framework:^13.0 --with-all-dependencies
composer validate --strict
composer audit --no-interaction
php artisan test
php artisan route:cache
php artisan config:cache

Release on behaviour, not version alone

Check login, authorisation, form errors, database changes and used integrations on production-equivalent PHP. Compare performance only with equivalent data and cache state; a new major promises no automatic speed gain. Keep old code and assets and assess schema and session compatibility before rollback. These snippets were not executed as a Laravel upgrade.

Bash syntax of the sample commands was checked. The commands, upgrade and production execution were not run; use them only in the suitable test environment described.

Technical deep dive: a framework upgrade is a compatibility change, not a version switch.

Illustrative scenario: the application is stable, but Laravel, PHP and several packages need to move together to a new supported combination. A successful Composer solve does not prove that routes, queues, authentication or deployment behaviour remain equivalent.

Technical decision

Define which critical flows must behave the same after the upgrade and which dependency changes can affect behaviour. Then upgrade in small steps with a reproducible install and explicit cache and migration checks.

Checks

  • Compare supported PHP, Laravel and package versions before changing lockfiles.
  • Re-run critical HTTP, queue, authentication and integration scenarios.
  • Check config, route and view cache with production-like release configuration.
  • Treat database migrations and rollback as separate risks, not as a side effect of composer update.

The actual compatibility problems differ per application and dependency set.

Last updated:

Need help with your Laravel upgrade?

Discuss your current Laravel version, key packages and critical user journeys directly with Jordy. Together we identify the checks and development work needed for the upgrade and agree the scope before implementation.