The Laravel team released v13.43.0 with deriving validation rules from a JSON schema, a #[RetryFor] queue attribute, the ability to release a job using backoff, a RawTemplate class for inline Blade components, and several security fixes:
Validation Rules From a JSON Schema
Pushpak Chhajed contributed JsonSchema::rules(), which converts an object schema into Laravel validation rules. Tools in the Laravel AI SDK and Laravel MCP describe their input with a JSON schema, and until now you had to repeat the same constraints as validation rules:
use Illuminate\JsonSchema\JsonSchema; $schema = JsonSchema::object(fn ($schema) => [ 'name' => $schema->string()->max(50)->required(), 'age' => $schema->integer()->min(18), 'role' => $schema->string()->enum(['admin', 'user'])->required(), ]); JsonSchema::rules($schema); // [ // 'name' => ['required', 'string', 'max:50'], // 'age' => ['sometimes', RejectEmptyString, 'integer', 'min:18'], // 'role' => ['required', 'string', Rule::in(['admin', 'user'])], // ]
The method also accepts a raw schema array, and the result works anywhere Laravel takes rules, such as Validator::make() or a form request. Nested properties become dot-notation keys like address.city and tags.*.
See #62355 and #62496 for more details.
The RetryFor Queue Attribute
Francisco Madeira contributed a #[RetryFor] attribute that sets a job's retry window without a retryUntil() method:
use Illuminate\Queue\Attributes\RetryFor; // Before class ImportProducts implements ShouldQueue { public function retryUntil(): DateTime { return now()->addHours(4); } } // After #[RetryFor(hours: 4)] class ImportProducts implements ShouldQueue { // }
The first argument is in seconds, and you can pass minutes and hours by name, as in #[RetryFor(hours: 1, minutes: 30)]. The attribute works on jobs, queued mailables, queued notifications, and queued listeners, and child classes inherit it. A retryUntil() method or $retryUntil property still takes precedence.
See #62434 for more details.
Release a Job Using Its Backoff
Francisco Madeira also added releaseUsingBackoff() to the InteractsWithQueue trait. The worker only applies a job's backoff when the job throws, so a job that releases itself, like one polling an API until a result is ready, had to look up the delay by hand:
#[Backoff(5, 15, 60, 300)] class WaitForExport implements ShouldQueue { use InteractsWithQueue; public function handle(): void { if (! $this->export->isReady()) { return $this->releaseUsingBackoff(); } $this->export->download(); } }
The delay is the backoff value for the current attempt, and once attempts run past the end of the list, every release uses the last value. A job with no backoff is released with no delay.
See #62435 for more details.
RawTemplate for Inline Blade Components
@JurianArie contributed a RawTemplate class for inline components. When a component's render() method returns a string that isn't a view name, Blade compiles the string as a template. If that string includes user input, such as a user's name, any Blade syntax in the input runs on the server.
Returning a RawTemplate makes the intent explicit:
use Illuminate\View\RawTemplate; public function render(): RawTemplate { return new RawTemplate(<<<'blade' <div class="alert">{{ $message }}</div> blade); }
The constructor's parameter is typed as a literal-string, so static analysis tools like PHPStan flag a template built from variables. The make:component --inline stub now returns a RawTemplate. Returning a plain string still works in Laravel 13.
See #62419 for more details.
Writes That Don't Affect Read Replica Stickiness
Jack Bayliss contributed withoutAffectingStickiness() to the database connection. With the sticky option enabled, any write sends the rest of the request's reads to the write connection. A write inside the callback, like a timestamp at the start of a job, leaves later reads on the read replica:
DB::withoutAffectingStickiness(function () { $this->task->update(['started_at' => now()]); }); // Reads still go to the read connection $this->task->run();
If the connection already had a write before the call, reads stay on the write connection.
See #62465 for more details.
Stringable isBlank() and isNotBlank()
Steve Bauman added isBlank() and isNotBlank() to fluent strings, which follow the same rules as the blank() helper:
// Before blank(str($bio)->stripTags()); // After str($bio)->stripTags()->isBlank(); str(' ')->isBlank(); // true str('0')->isBlank(); // false
See #62415 for more details.
Security Fixes and Horizon 5.47
This release includes several security fixes from the 12.x branch. They cover temporary signed URLs whose expiration could be bypassed with array or numeric query parameters, XSS in component attributes and the debug page's "copy request URL" button, a mass-assignment guard bypass through mutator attribute names, a file validation bypass, and unbounded $ref chains in the JSON Schema deserializer.
The framework now also declares a conflict with laravel/horizon versions below 5.47.0, which are incompatible with the current framework release. If your app uses an older Horizon version, Composer will ask you to upgrade Horizon along with the framework.
Release Notes
You can see the complete list of new features and updates below and the diff between 13.42.0 and 13.43.0 on GitHub. The following release notes are directly from the changelog:
v13.43.0
- [12.x] Prevent escaping from bypassing protection by @valorin in https://github.com/laravel/framework/pull/62027
- [12.x] Cloud exceptions by @timacdonald in https://github.com/laravel/framework/pull/61934
- [12.x] Cloud exceptions improvements by @timacdonald in https://github.com/laravel/framework/pull/62186
- [12.x] Fallback retrieving
expiresquery string fromQUERY_STRINGheader by @crynobone in https://github.com/laravel/framework/pull/62349 - [12.x] Return each event's own expression and timezone from
schedule:list --jsonby @xiCO2k in https://github.com/laravel/framework/pull/62358 - [12.x] Enforce valid email address comply with RFC 5321 by @crynobone in https://github.com/laravel/framework/pull/62347
- [12.x] Fix temporary signed URL expiration bypass via numeric query-fragment parameter smuggling by @crynobone in https://github.com/laravel/framework/pull/62401
- [12.x] Fix nested sometimes validation rules are skipped when the value is
__missing__by @crynobone in https://github.com/laravel/framework/pull/62402 - [12.x] Allows to retrieves
expiresfrom$_SERVER['VAPOR_RAW_QUERY_STRING']by @crynobone in https://github.com/laravel/framework/pull/62391 - [12.x] Fix not_regex passing when the pattern match fails by @pushpak1300 in https://github.com/laravel/framework/pull/62428
- [13.x] Fix not_regex passing when the pattern match fails by @pushpak1300 in https://github.com/laravel/framework/pull/62427
- [12.x] Compare fluent database rule
where()values literally by @pushpak1300 in https://github.com/laravel/framework/pull/62426 - [13.x] Compare fluent database rule
where()values literally by @pushpak1300 in https://github.com/laravel/framework/pull/62425 - [12.x] Use possessive quantifiers in decimal validation rule by @pushpak1300 in https://github.com/laravel/framework/pull/62421
- [13.x] Use possessive quantifiers in decimal validation rule by @pushpak1300 in https://github.com/laravel/framework/pull/62420
- [12.x] Fix XSS in debug page's "copy request URL" by @crynobone in https://github.com/laravel/framework/pull/62418
- [12.x] Fix EncodedParameter being encoded again in numeric query parameters by @ghabriel25 in https://github.com/laravel/framework/pull/62417
- [13.x] Add isBlank() and isNotBlank() to Stringable by @stevebauman in https://github.com/laravel/framework/pull/62415
- [13.x] Fix ambiguous updated_at column when calling touch() on a query with joins by @mrjavadseydi in https://github.com/laravel/framework/pull/62412
- [12.x] Prevent array
expiresparameters from bypassing signed URL expiration by @GrahamCampbell in https://github.com/laravel/framework/pull/62411 - [13.x] Tweak release.sh by @jackbayliss in https://github.com/laravel/framework/pull/62407
- [12.x] Fix
Arr::forget()removing the wrong element by @GrahamCampbell in https://github.com/laravel/framework/pull/62410 - [13.x] Allow Windows separators for paths inside the running phar by @pushpak1300 in https://github.com/laravel/framework/pull/62413
- [13.x] Ensure WorkComand shows manually failed jobs as failed by @jackbayliss in https://github.com/laravel/framework/pull/62377
- [12.x] Fix wildcard validation rules skipping empty array keys by @GrahamCampbell in https://github.com/laravel/framework/pull/62409
- Merge tag 'v12.72.0' into 13.x by @crynobone in https://github.com/laravel/framework/pull/62437
- [12.x] Compare integers and booleans as strings in the database presence verifier by @pushpak1300 in https://github.com/laravel/framework/pull/62448
- [13.x] Compare integers and booleans as strings in the database presence verifier by @pushpak1300 in https://github.com/laravel/framework/pull/62447
- [13.x] Speed up slow tests by @JurianArie in https://github.com/laravel/framework/pull/62443
- [13.x] Keep every where on the same column in exists and unique rules by @raghavji2050 in https://github.com/laravel/framework/pull/62442
- [13.x] Add
releaseUsingBackoff()toInteractsWithQueueby @xiCO2k in https://github.com/laravel/framework/pull/62435 - [13.x] Add
#[RetryFor]queue attribute by @xiCO2k in https://github.com/laravel/framework/pull/62434 - [13.x] Fix union cursor pagination when ordering by an aliased expression by @mrjavadseydi in https://github.com/laravel/framework/pull/62433
- [13.x] Cache more Model reflection bits by @jackbayliss in https://github.com/laravel/framework/pull/62432
- [13.x] Fix DatabaseTransactionsManager::commit() return type by @dhrupo in https://github.com/laravel/framework/pull/62431
- [13.x] Fix PHP 8.5 deprecation when calling from() with a subquery and no alias by @alies-dev in https://github.com/laravel/framework/pull/62430
- [13.x] Add RawTemplate for inline Blade components by @JurianArie in https://github.com/laravel/framework/pull/62419
- [13.x] Add withoutAffectingStickiness to Connection by @jackbayliss in https://github.com/laravel/framework/pull/62465
- [13.x] Speed up wildcard attribute lookups during validation by @Afcyy in https://github.com/laravel/framework/pull/62464
- [12.x] Keep every where on the same column in exists and unique rules by @raghavji2050 in https://github.com/laravel/framework/pull/62463
- [13.x] Ignore extension-owned tables when dropping all tables on PostgreSQL by @raghavji2050 in https://github.com/laravel/framework/pull/62460
- [13.x] Keep every condition on the same column in string exists and unique rules by @raghavji2050 in https://github.com/laravel/framework/pull/62459
- [12.x] Render bound attributes of dynamic class components like the component tag by @pushpak1300 in https://github.com/laravel/framework/pull/62456
- [13.x] Render bound attributes of dynamic class components like the component tag by @pushpak1300 in https://github.com/laravel/framework/pull/62455
- [13.x] Mark laravel/horizon <5.47.0 as conflicting by @agustingomes in https://github.com/laravel/framework/pull/62449
- [13.x] Pipeline tagged Redis cache reads by @0x15f in https://github.com/laravel/framework/pull/62451
- [12.x] Ignore extension-owned tables when dropping all tables on PostgreSQL by @raghavji2050 in https://github.com/laravel/framework/pull/62477
- [12.x] Keep every condition on the same column in string exists and unique rules by @raghavji2050 in https://github.com/laravel/framework/pull/62476
- Disconnect every database connection when the test environment is torn down by @GromNaN in https://github.com/laravel/framework/pull/62471
- [13.x] Validate dynamic component, slot, and attribute names by @pushpak1300 in https://github.com/laravel/framework/pull/62453
- [12.x] Validate dynamic component, slot, and attribute names by @pushpak1300 in https://github.com/laravel/framework/pull/62454
- [13.x] Retry idempotent Predis commands after losing the connection by @besanek in https://github.com/laravel/framework/pull/62406
- [13.x] Add JsonSchema::rules() to derive validation rules from a schema by @pushpak1300 in https://github.com/laravel/framework/pull/62355
- Run component splits and release tagging in GitHub Actions by @joetannenbaum in https://github.com/laravel/framework/pull/62468
- [12.x] Fix deprecation when calling from() with a subquery and no alias by @raghavji2050 in https://github.com/laravel/framework/pull/62482
- Bump softprops/action-gh-release from 3.0.3 to 3.0.4 in the github-actions group by @dependabot[bot] in https://github.com/laravel/framework/pull/62497
- [13.x] Add del to RETRYABLE_COMMANDS by @jackbayliss in https://github.com/laravel/framework/pull/62502
- [12.x] Add JsonSchema::rules() to derive validation rules from a schema by @pushpak1300 in https://github.com/laravel/framework/pull/62501
- [12.x] Fix Eloquent mass-assignment guard bypass via mutator attribute-name normalization mismatch by @crynobone in https://github.com/laravel/framework/pull/62499
- [12.x] Prevent DoS in
Illuminate\JsonSchema\Deserializerby bounding$refchain depth by @crynobone in https://github.com/laravel/framework/pull/62498 - [13.x] Support exclusiveMinimum and exclusiveMaximum in JsonSchema::rules() by @raghavji2050 in https://github.com/laravel/framework/pull/62496
- [12.x] Splitter workflow by @joetannenbaum in https://github.com/laravel/framework/pull/62507
- [12.x] Disconnect database connections when the test environment is torn down by @raghavji2050 in https://github.com/laravel/framework/pull/62494
- [12.x] Log dropped Cloud events to stderr by @jradtilbrook in https://github.com/laravel/framework/pull/62493
- [12.x] Check Forge and Vapor environment variables instead of just
Hostvalues by @crynobone in https://github.com/laravel/framework/pull/62484 - [13.x] Log dropped Cloud events to stderr by @jradtilbrook in https://github.com/laravel/framework/pull/62438
- [12.x] Preserve relation constraints when resolving attributes during noConstraints by @crynobone in https://github.com/laravel/framework/pull/62483
- [13.x] Compare JSON Schema uniqueItems scalars strictly by @raghavji2050 in https://github.com/laravel/framework/pull/62495
- [12.x] Fix XSS in component attributes by @crynobone in https://github.com/laravel/framework/pull/62503
- Compare user IDs as strings in broadcasting routes stub by @pushpak1300 in https://github.com/laravel/framework/pull/62500
- [12.x] Updated split/release workflows by @joetannenbaum in https://github.com/laravel/framework/pull/62513
- Merge branch '12.x' into 13.x by @crynobone in https://github.com/laravel/framework/pull/62520
- [13.x] Add AutoCompletePrompt fallback by @imsvidskiy in https://github.com/laravel/framework/pull/62522
- [13.x] Fix trans_choice ignoring conditions after " | " by @mrjavadseydi in https://github.com/laravel/framework/pull/62519
- [13.x] Fix file validation bypass with empty input field collisions by @crynobone in https://github.com/laravel/framework/pull/62521
- [13.x] Fix withCasts() on relations not applying to Relation::create() by @arielembeya223 in https://github.com/laravel/framework/pull/62517