Introduction
Laravel 11 was released in March 2024. This guide walks through upgrading from Laravel 10.x to 11.x.Estimated time to upgrade is about 15 minutes. Actual impact from breaking changes depends on your app’s size and the features you use.
Automated upgrades with Laravel Shift
You can automate the upgrade with Laravel Shift. Shift updates dependencies and configuration files automatically.Changes by impact level
Impact: high
- Dependency updates
- Application structure changes
- Floating-point type changes
- Preserving attributes when modifying columns
- SQLite minimum version
- Sanctum update
Impact: medium
- Carbon 3
- Password re-hashing
- Per-second rate limits
- Spatie Once package
Impact: low
- Doctrine DBAL removal
- The Eloquent model
castsmethod - Spatial type changes
- The
Enumerablecontract - The
UserProvidercontract - The
Authenticatablecontract
Upgrade steps
Update dependencies
Impact: high Update the following dependencies incomposer.json.
doctrine/dbal manually, you can remove it. Laravel 11 no longer depends on this package.
PHP version requirement
Impact: high Laravel 11 requires PHP 8.2.0 or later. Laravel’s HTTP client also requires curl 7.34.0 or later.Application structure changes
Impact: high Laravel 11 simplifies the default application structure. The number of service providers, middleware, and configuration files has been substantially reduced. That said, we do not recommend attempting to migrate your Laravel 10 app to the new structure when upgrading. Laravel 11 is designed to also support the Laravel 10 application structure. Main structural changes:- Middleware, exception handlers, and routing are now configured directly in
bootstrap/app.php app/Http/Kernel.phphas been removed and integrated intobootstrap/app.php- The default number of service providers has been reduced and are managed via
bootstrap/providers.php - The number of files in
config/has been reduced (you can publish them as needed viaphp artisan config:publish)
Breaking changes
Authentication
Password re-hashing
Impact: medium Laravel 11 automatically re-hashes passwords at authentication time if the hash algorithm’s “work factor” has changed. If yourUser model’s password field isn’t named password, specify it via the authPasswordName property on the model.
config/hashing.php.
The UserProvider contract
Impact: low
The Illuminate\Contracts\Auth\UserProvider contract adds a rehashPasswordIfRequired method. If you have a class implementing this interface, add the method.
The Authenticatable contract
Impact: low
The Illuminate\Contracts\Auth\Authenticatable contract adds a getAuthPasswordName method. If you have a class implementing this interface, add the method.
Database
SQLite minimum version
Impact: high If you use SQLite, SQLite 3.26.0 or later is required. Note that new Laravel 11 projects use SQLite as the default database driver.Preserving attributes when modifying columns
Impact: high When modifying a column, you must explicitly specify every modifier you want retained. Attributes you don’t specify are dropped.Floating-point type changes
Impact: high Thedouble and float migration column types have been unified across databases.
unsignedDecimal, unsignedDouble, and unsignedFloat methods have been removed. To keep the unsigned attribute, chain it.
The Eloquent model casts method
Impact: low
A casts method is now defined on the base Eloquent model class. If your app defines a relation named casts, it collides with the base name and needs to be renamed.
Dedicated MariaDB driver
Impact: very low Laravel 11 adds a dedicated database driver for MariaDB. When connecting to MariaDB, use themariadb driver in configuration.
Spatial type changes
Impact: low Spatial column types have been unified across databases. Instead of methods likepoint, lineString, and polygon, use geometry or geography.
subtype and srid to explicitly specify type and spatial reference system.
Doctrine DBAL removal
Impact: low Laravel no longer depends on Doctrine DBAL. The following classes and methods have been removed.Schema\Builder::useNativeSchemaOperationsIfPossible()Connection::getDoctrineConnection()Connection::getDoctrineSchemaManager()Connection::registerDoctrineType()DatabaseManager::registerDoctrineType()- The
Schema\Grammars\ChangeColumnclass - The
Schema\Grammars\RenameColumnclass
Schema::getTables(), Schema::getColumns(), Schema::getIndexes(), and Schema::getForeignKeys().
Dates
Carbon 3
Impact: medium Laravel 11 supports both Carbon 2 and Carbon 3. When upgrading to Carbon 3, note thatdiffIn* methods now return floating-point numbers, and negative values indicate the direction of time.
Rate limits
Per-second rate limits
Impact: medium Laravel 11 supports rate limits measured in seconds rather than minutes. TheGlobalLimit and Limit class constructors now take seconds.
Limit class’s decayMinutes property has been renamed to decaySeconds and is now in seconds.
The ThrottlesExceptions and ThrottlesExceptionsWithRedis constructors also take seconds.
Packages
Publishing service providers
Impact: very low New Laravel 11 apps don’t have aproviders array in config/app.php. If your package publishes a service provider, use ServiceProvider::addProviderToBootstrapFile.
Sanctum
Sanctum update
Impact: high Laravel 11 doesn’t support Sanctum 3.x. Update the Sanctum dependency to^4.0 in your composer.json.
Sanctum 4.0 no longer loads its migrations automatically. Publish them with the following command.
config/sanctum.php.
Spatie Once package
Impact: medium Laravel 11 provides its ownonce function. If you use the spatie/once package, remove it from composer.json to avoid conflicts.
Summary
Laravel 11 involves major structural changes, but since Laravel 10’s application structure continues to work, you can migrate incrementally.References
- Official upgrade guide (English)
- laravel/laravel diff (10.x → 11.x)
- Laravel Shift — community service to automate upgrades
- Carbon 3 changelog