Documentation Index
Fetch the complete documentation index at: https://kawax.biz/llms.txt
Use this file to discover all available pages before exploring further.
Introduction
Laravel 10 was released on February 14, 2023. This guide covers everything you need to upgrade a Laravel 9.x application to 10.x.Estimated upgrade time: about 10 minutes. The actual impact depends on the size of your application and which features you use.
Automated upgrade with Laravel Shift
You can automate much of the upgrade process using Laravel Shift. Shift automatically updates your dependencies and configuration files.Changes by impact level
High impact
- Updating dependencies
- Updating
minimum-stability
Medium impact
- Database expression changes
- Removing the
$datesproperty from models - Monolog 3
- Redis cache tags
- Service mocking changes
- Language directory
Low impact
- Closure validation rule messages
- Form request
aftermethod - Public path binding
QueryExceptionconstructor- Rate limiter return value
- Removing
Redirect::home - Removing
Bus::dispatchNow registerPoliciesmethod- ULID columns
Upgrade steps
Updating dependencies
High impact Update the following entries in yourcomposer.json:
Updating minimum-stability
High impact
Update minimum-stability in your composer.json to stable. Since stable is the default, you can also remove the setting entirely.
PHP version requirements
High impact Laravel 10 requires PHP 8.1.0 or higher and Composer 2.2.0 or higher.Breaking changes
Application
Public path binding
Low impact If you customized the public path by bindingpath.public in the container, switch to the usePublicPath method on Illuminate\Foundation\Application:
Authorization
registerPolicies method
Low impact
The registerPolicies method on AuthServiceProvider is now called automatically by the framework. You can remove the explicit call from your boot method.
Cache
Redis cache tags
Medium impactCache::tags() is now only recommended for applications that use Memcached as the cache driver. If you use Redis as your cache driver, consider migrating to Memcached.
Database
Database expression changes
Medium impact Database expressions created withDB::raw have been rewritten. To retrieve the raw string value of an expression, use the getValue(Grammar $grammar) method. Casting to (string) is no longer supported.
QueryException constructor
Very low impact
The Illuminate\Database\QueryException constructor now accepts a string connection name as its first argument. Update any code that throws this exception manually.
ULID columns
Low impact When you call theulid method in a migration without arguments, the column is now named ulid. In earlier releases, calling it without arguments incorrectly created a column named uuid.
Eloquent
The model $dates property
Medium impact
The deprecated $dates property on Eloquent models has been removed. Use the $casts property instead.
Localization
Language directory
No impact Existing applications are not affected, but the skeleton for new Laravel applications no longer includes alang directory by default. If you need it, publish it with the Artisan command:
Logging
Monolog 3
Medium impact Laravel’s Monolog dependency has been updated to Monolog 3.x. If your application uses Monolog directly, review the Monolog upgrade guide. If you use a third-party logging service such as BugSnag or Rollbar, you may need to upgrade to a version that supports Monolog 3.x and Laravel 10.x.Queues
Removing Bus::dispatchNow
Low impact
The deprecated Bus::dispatchNow and dispatch_now helpers have been removed. Use Bus::dispatchSync and dispatch_sync instead.
Routing
Middleware aliases
Optional In new Laravel applications, the$routeMiddleware property on App\Http\Kernel has been renamed to $middlewareAliases. Applying this change to existing applications is optional.
Rate limiter return value
Low impact When you callRateLimiter::attempt, the return value of the provided closure is now returned directly. If the closure returns nothing or null, the method returns true.
Removing Redirect::home
Very low impact
The deprecated Redirect::home method has been removed. Redirect to an explicit named route instead.
Testing
Service mocking
Medium impact The deprecatedMocksApplicationServices trait has been removed from the framework. This trait provided test methods such as expectsEvents, expectsJobs, and expectsNotifications.
Migrate to Event::fake, Bus::fake, and Notification::fake respectively.
Validation
Closure validation rule messages
Very low impact When a closure-based custom validation rule calls the$fail callback multiple times, messages are now appended to an array instead of overwriting each other.
The $fail callback also now returns an object. Update any code that type-hints the return value of a validation closure.
Form request after method
Very low impact
The after method is now reserved by Laravel on form requests. If you have defined an after method on a form request, rename or update it to use the new “after validation” hook feature.
Summary
Laravel 10 is a relatively small release and the upgrade is quick to complete.| Change | Impact | Action required |
|---|---|---|
Update composer.json dependencies | High | Change to laravel/framework ^10.0 |
| PHP 8.1 / Composer 2.2 required | High | Check and update versions |
| Database expression changes | Medium | Replace (string) cast with getValue() |
$dates property removed | Medium | Migrate to $casts |
| Monolog 3 | Medium | Review if you use Monolog directly |
| Redis cache tags | Medium | Consider migrating to Memcached |
MocksApplicationServices removed | Medium | Migrate to Event::fake etc. |
Bus::dispatchNow removed | Low | Switch to Bus::dispatchSync |
| ULID column naming | Low | Review ulid() calls in migrations |
Redirect::home removed | Very low | Switch to Redirect::route('home') |
References
- Official upgrade guide
- laravel/laravel diff (9.x → 10.x)
- Laravel Shift — automated upgrade service
- Sanctum upgrade guide (2.x → 3.x)
- Monolog 3.x upgrade guide