Never Miss a Laravel Release 🚀
The Laravel team released version 12.29.0 this week with a new local debug page, a cache session driver, model resource PHP attributes, and more.
New Local Debug Page
Ryuta Hamasaki and Jeremy Butler created a brand-new local exception page for Laravel applications. The new exception page retains the "Copy as Markdown" button released in Laravel 12.25, and removes manual dark/light/toggle in favor of automatically detecting light vs. dark mode.
See Pull Request #57036 for details.
Cache Session Driver
João Pedro Lopes—along with various community developers and core Laravel team members—contributed a cache session driver. It's best to read through the discussion and code in Pull Request #56887, but here's an example from that discussion of sticky database connections across requests:
namespace App\Http\Middleware; use Closure;use Illuminate\Http\Request;use Illuminate\Support\Facades\Context;use Illuminate\Support\Facades\Date;use Illuminate\Support\Facades\DB;use Symfony\Component\HttpFoundation\Response; class StickyWriteConnections{ public function handle(Request $request, Closure $next): Response { if (! $request->hasSession()) { return $next($request); } $expiry = $request->session()->cache()->get('use_write_connection_until'); $expiry?->isFuture() && DB::connection('pgsql')->useWriteConnectionWhenReading() && Context::addHidden('use_write_connection_until', $expiry); $response = $next($request); (DB::getConnections()['pgsql'] ?? null)?->hasModifiedRecords() && $request->session()->cache()->remember('use_write_connection_until', 10); return $response; }}
UseResource and UseResource Collection Attributes
Luca Patera contributed the ability to define resource classes directly on a model using PHP attributes. Using these attributes, you can avoid boilerplate when converting a model to the intended resource:
// Before$model->toResource(MyCustomNameResource::class);$collection->toResourceCollection(MyCustomNameCollectionResource::class); // After$model->toResource();$collection->toResourceCollection();
Model attributes are defined on the model class, as follows:
use App\Http\Resources\MyCustomNameResource;use App\Http\Resources\MyCustomNameCollectionResource; #[UseResource(MyCustomNameResource::class)]#[UseResourceCollection(MyCustomNameCollectionResource::class)]class MyModel extends Model {}
See Pull Request #56966 for details.
JSON Format Added to the schedule:list Command
Danny Foster contributed a --json flag to the schedule:list Artisan command. Returning this data as JSON is useful for monitoring deployments and integrations. Here's an example from the pull request:
[ { "expression": "0 0 15 * *", "repeat_seconds": null, "command": "php artisan backup:run", "description": "Run daily backup process", "next_due_date": "2025-09-15 00:00:00 +00:00", "next_due_date_human": "5 days from now", "timezone": "UTC", "has_mutex": false }]
This enables neat commands piped to things like the jq for monitoring to ensure scheduled tasks exist during a deployment, for example:
php artisan schedule:list --json | jq '.[] | select(.command | contains("backup"))'
Release notes
You can see the complete list of new features and updates below and the diff between 12.28.0 and 12.29.0 on GitHub. The following release notes are directly from the changelog:
v12.29.0
- Ensure cached and uncached routes share same precedence when resolving actions and names by @timacdonald in https://github.com/laravel/framework/pull/56920
- [12.x] Re-enable previously commented assertions by @AhmedAlaa4611 in https://github.com/laravel/framework/pull/56930
- [12.x] Reorder .gitignore entries for consistency and readability by @AhmedAlaa4611 in https://github.com/laravel/framework/pull/56963
- [12.x] SQLite: Allow setting any pragmas by @stancl in https://github.com/laravel/framework/pull/56962
- refactor: remove unused array from docblock by @alipowerful7 in https://github.com/laravel/framework/pull/56961
- PendingResourceRegistration withoutMiddleware never returns array by @moshe-autoleadstar in https://github.com/laravel/framework/pull/56959
- [12.x] Allow not having "fakerphp/faker" installed by @SjorsO in https://github.com/laravel/framework/pull/56953
- [12.x] Fix Validator placeholderHash PHPDoc by @AhmedAlaa4611 in https://github.com/laravel/framework/pull/56947
- [12.x] Handle MariaDB innodb_snapshot_isolation=ON by @Muffinman in https://github.com/laravel/framework/pull/56945
- [12.x] Add PhpRedis pack ignore numbers option by @tuandp in https://github.com/laravel/framework/pull/56941
- test(support): add edge-case tuples for preg_replace_array by @realpvz in https://github.com/laravel/framework/pull/56937
- [12.x] Allow for BackedEnum on dynamic blade component by @gehrisandro in https://github.com/laravel/framework/pull/56940
- [12.x] Remove one redundant array access by @vincentvanhoven in https://github.com/laravel/framework/pull/56931
- [12.x] Add withoutGlobalScopesExcept() to keep only specified global scopes by @theHocineSaad in https://github.com/laravel/framework/pull/56957
- [12.x] Make visibility consistent by @AhmedAlaa4611 in https://github.com/laravel/framework/pull/56970
- [12.x] Change list to tuple in PHPDoc block by @shaedrich in https://github.com/laravel/framework/pull/56967
- [12.x] Improve
AggregateServiceProviderdocblocks by @cosmastech in https://github.com/laravel/framework/pull/56968 - [12.x] add --whisper option to schedule:work command by @thojo0 in https://github.com/laravel/framework/pull/56969
- [12.x] Update Faker suggestion to match skeleton version by @AhmedAlaa4611 in https://github.com/laravel/framework/pull/56974
- Refactor: use str_contains() instead of strpos() for clarity by @arshidkv12 in https://github.com/laravel/framework/pull/56979
- [12.x] remove unnecessary
with()helper call by @browner12 in https://github.com/laravel/framework/pull/56975 - [12.x] Config: Move some items into pragmas by @AhmedAlaa4611 in https://github.com/laravel/framework/pull/56980
- Add callback support to takeUntilTimeout in LazyCollection by @kamilkozak in https://github.com/laravel/framework/pull/56981
- [12.x] Utilize the is_finite() PHP function by @AhmedAlaa4611 in https://github.com/laravel/framework/pull/56990
- [12.x] Use property promotion in
MessageLoggedand narrow$levelby @cosmastech in https://github.com/laravel/framework/pull/56989 - [12.x] do not use
with()helper when no second argument is passed by @browner12 in https://github.com/laravel/framework/pull/56986 - [12.x] Correct the type of $handler from Connection::whenQueryingForLongerThan by @sethsandaru in https://github.com/laravel/framework/pull/56987
- [12.x] Some quick fixes by @theHocineSaad in https://github.com/laravel/framework/pull/56991
- tests: Ensure transaction callbacks run in FIFO order by @realpvz in https://github.com/laravel/framework/pull/56973
- Pass $attributes and $parent arguments to Factory Sequence by @fritz-c in https://github.com/laravel/framework/pull/56972
- [12.x] - Support
CastableonEnumby @jrseliga in https://github.com/laravel/framework/pull/56977 - [12.x] add trailing commas in multiline method signatures by @browner12 in https://github.com/laravel/framework/pull/56992
- [12.x] Improve docblocks for nullable parameters by @amirhshokri in https://github.com/laravel/framework/pull/56995
- [12.x] Improve docblocks for nullable parameters by @amirhshokri in https://github.com/laravel/framework/pull/56996
- [12.x] Improve docblocks for nullable parameters by @amirhshokri in https://github.com/laravel/framework/pull/56997
- Revert "[12.x] Config: Move some items into pragmas" by @taylorotwell in https://github.com/laravel/framework/pull/57003
- [12.x]: Cache Session Driver by @joaopalopes24 in https://github.com/laravel/framework/pull/56887
- [12.x] Add support for #[UseResource(...)] and #[UseResourceCollection(...)] attributes on models by @Lukasss93 in https://github.com/laravel/framework/pull/56966
- [12.x] Test Improvements by @crynobone in https://github.com/laravel/framework/pull/57010
- [12.x] Test Improvements by @crynobone in https://github.com/laravel/framework/pull/57031
- [12.x] Infinite method chaining in contextual binding builder by @daniser in https://github.com/laravel/framework/pull/57026
- [12.x] Improved manager typehints by @daniser in https://github.com/laravel/framework/pull/57024
- Bump vite from 5.4.19 to 5.4.20 in /src/Illuminate/Foundation/resources/exceptions/renderer by @dependabot[bot] in https://github.com/laravel/framework/pull/57009
- [12.x] Correct APC cache store docblock types by @xurshudyan in https://github.com/laravel/framework/pull/57020
- [12.x] Enable dynamic tries() method on Queueable Listeners by @glioympas in https://github.com/laravel/framework/pull/57014
- [12.x] Add --json option to ScheduleListCommand by @dxnter in https://github.com/laravel/framework/pull/57006
- [12.x]
with()helper call simplification by @browner12 in https://github.com/laravel/framework/pull/57041 - [12.x] handle all Enum types for default values by @browner12 in https://github.com/laravel/framework/pull/57040
- [12.x] Refactor chained method calls for readability by @AhmedAlaa4611 in https://github.com/laravel/framework/pull/57050
- [12.x] Improve docblock wording by @AhmedAlaa4611 in https://github.com/laravel/framework/pull/57056
- [12.x] Refactor chained method calls for readability by @AhmedAlaa4611 in https://github.com/laravel/framework/pull/57054
- [12.x] Update local exception page by @avosalmon in https://github.com/laravel/framework/pull/57036
- [12.x] Add ability to control QueueWorker memory exceeded exit code by @jackbayliss in https://github.com/laravel/framework/pull/57044
- [12.x] Ensure
laravel-cloud-socketrespectsLOG_LEVELby @PeteBishwhip in https://github.com/laravel/framework/pull/57071