Typed Translation Accessors in Laravel 13.15.0

Last updated on by

Typed Translation Accessors in Laravel 13.15.0 image

The Laravel team released v13.15.0 with typed translation accessors, JSON Schema deserialization, a dedicated Cloud queue driver, and a couple of security-related validation and routing fixes.

  • Typed trans()->string() and trans()->array() accessors
  • JSON Schema array deserialization and multi-type union support
  • A dedicated Cloud queue driver with managed queue handling
  • A fix for a date_equals validation bypass and tighter route unserialization

What's New

Typed Translation Accessors

The translation helpers return broad types: __() returns array|string|null, and trans() returns Translator|array|string. That works in Blade, but it adds friction in strictly-typed code and static analysis. This release adds two typed accessors on the Translator to return a concrete type:

public function label(): string
{
return trans()->string($this->name);
}
 
public function options(): array
{
return trans()->array($this->options_key);
}

The approach mirrors existing typed helpers like config() and request(). See #60443.

JSON Schema Deserialization

The JsonSchema component gained a fromArray() deserializer that turns a raw JSON Schema array back into Type objects, the inverse of serialization. The release also adds multi-type union support to the schema builder. See #60387 and #60455.

Dedicated Cloud Queue Driver

Several changes land a dedicated queue driver for Laravel Cloud's managed queues. Managed queues are booted before service providers, the queue throws a ManagedQueueNotFoundException when a configured queue is missing, and FIFO queue name normalization was corrected. The request ID header was renamed from X-Request-ID to Cloud-Request-ID and is now output in logs. See #60181, #60199, #60276, #60189, #60166, and #60316.

Enums in Queue::route()

You can now pass enum cases to Queue::route() for both the queue name and the connection when routing jobs. See #60402.

Security: date_equals Validation Bypass

The date_equals rule used loose comparison. An invalid date string parses to null, and null == 0 evaluates to true, so an invalid date could pass validation against a reference date that parses to a falsy value (for example 1970-01-01 00:00:00). The fix uses strict comparison for the equal operator while keeping loose comparison for legitimate DateTime objects. See #60393.

Security: Restricted Route Unserialization

Routing unserialization now restricts the classes it will accept, reducing the surface for object injection during route caching and resolution. See #60391.

Number Helper Fixes

A few edge cases in the Number helper were corrected: Number::fileSize() now handles negative byte values, Number::trim() no longer returns null for INF and NAN, and Number::pairs() now handles negative step values gracefully while throwing an exception for a zero step to prevent infinite loops. See #60147, #60322, and #60324.

Other Fixes and Improvements

  • Fixed infinite recursion when a model scope is defined with a private attribute, and when a middleware group references itself (#59958, #60002)
  • queue:failed now shows the real class name (#60279)
  • Added Prohibitable to cache:clear and queue:flush (#60430)
  • Made InvokedProcess macroable (#60392)
  • Ensured unchanged compiled Blade views are not left expired (#60401)
  • Added generics to DatabaseTransactionsManager getters and QueueRoutes::all() (#60420, #60447)

References

Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.

image
Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Visit Laravel Cloud
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
PhpStorm logo

PhpStorm

The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

PhpStorm
No Compromises logo

No Compromises

Joel and Aaron, the two seasoned devs from the No Compromises podcast, are now available to hire for your Laravel project. ⬧ Flat rate of $9500/mo. ⬧ No lengthy sales process. ⬧ No contracts. ⬧ 100% money back guarantee.

No Compromises
Acquaint Softtech logo

Acquaint Softtech

Acquaint Softtech offers AI-ready Laravel developers who onboard in 48 hours at $3000/Month with no lengthy sales process and a 100 percent money-back guarantee.

Acquaint Softtech
Laravel Cloud logo

Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Cloud
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
Harpoon: Next generation time tracking and invoicing logo

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing

The latest

View all →
Refresh Your Laravel Database Without Dropping Every Table image

Refresh Your Laravel Database Without Dropping Every Table

Read article
JSON Schema Deserialization in Laravel 13.14 image

JSON Schema Deserialization in Laravel 13.14

Read article
Generate Short, URL-Safe IDs From Numbers With Sqids image

Generate Short, URL-Safe IDs From Numbers With Sqids

Read article
Scheduler List: A Web Dashboard for Laravel's Scheduled Tasks image

Scheduler List: A Web Dashboard for Laravel's Scheduled Tasks

Read article
Community Laravel Extension for Zed image

Community Laravel Extension for Zed

Read article
Advanced Eloquent Query Filtering with Filterable image

Advanced Eloquent Query Filtering with Filterable

Read article