Laravel 10.9 Released
The Laravel team has released version 10.9 with several new features and enhancements. Among the changes are named static methods for middleware, new HTTP status assertions for feature testing, and the ability to prune all canceled and unfinished queue batches.
Additionally, Ignition IDE links with work with the artisan serve command, which allows them to open files in their IDE by clicking on the filename displayed on an Ignition error page.
Let's look at the features and changes introduced in Laravel 10.9:
Named Static Methods for Middleware
Tim MacDonald continued enhancing alternative more "PHPish" ways to define route middleware. Here are some examples from Pull Request #46362:
Route::get('users', UserController::class)
->middleware([
Authenticate::class, // default.
Authenticate::using('web'), // specify a guard.
Authenticate::using('web', 'another'), // specify multiple guards.
Authorize::using('store', Post::class),
EnsureEmailIsVerified::class, // default.
EnsureEmailIsVerified::redirectTo('route.name'),
]);
New HTTP Status Assertions
Miran AL Mehrab contributed three new HTTP status assertions for writing feature tests in Laravel:
$response->assertGone(); // 410
$response->assertInternalServerError(); // 500
$response->assertServiceUnavailable(); // 503
Allow Pruning All Cancelled and Unfinished Queue Batches
James Hulse contributed an update to queue:prune-batches
that allows you to prune unfinished and canceled batches with the --infinished=0
and --cancelled=0
flags. Now, the code will check for non-null values. See Pull Request #46833 for more details.
Configure Ignition IDE Links With artisan serve
Niclas contributed the ability to pass-through IGNITION_LOCAL_SITES_PATH
to the artisan serve command, which enables you to open files in your IDE by clicking on the filename displayed on an Ignition error page.
See Pull Request #46857 for further details.
Release Notes
You can see the complete list of new features and updates below and the diff between 10.8.0 and 10.9.0 on GitHub. The following release notes are directly from the changelog:
Added
- Add new HTTP status assertions (#46841)
- Allow pruning all cancelled and unfinished queue batches (#46833)
- Added
IGNITION_LOCAL_SITES_PATH
to$passthroughVariables
inServeCommand.php
(#46857) - Added named static methods for middleware (#46362)
Fixed
- Fix date_format rule throw ValueError (#46824)
Changed
- Allow separate directory for locks on filestore (#46811)
- Allow to whereMorphedTo work with null model (#46821)
- Use pivot model fromDateTime instead of assuming Carbon in
Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable::addTimestampsToAttachment()
(#46822) - Make rules method in FormRequest optional (#46846)
- Throw LogicException when calling FileFactory@image() if mimetype is not supported (#46859)
- Improve job release method to accept date instance (#46854)
- Use foreignUlid if model uses HasUlids trait when call foreignIdFor (#46876)