News

Typed Arr Getters Added in Laravel 12.11

Published
Typed Arr Getters Added in Laravel 12.11 image

Release updates

Never miss a Laravel release

Get an email whenever a new Laravel release lands.

The Laravel team released v12.11.0, which includes typed Arr getter methods, job payload additions, the FakeJob class now implements the Job contract, and more:

Typed Getters for Arr Helpers

Anthony Tibbs contributed typed getter helpers for the Arr support class for array, boolean, float, integer, and string. Each method will attempt to return the type and throw an exception if the data doesn't match types:

use Illuminate\Support\Arr;
$array = ['name' => 'Joe', 'languages' => ['PHP', 'Ruby']];
 
$value = Arr::array($array, 'languages'); // ['PHP', 'Ruby']
$value = Arr::array($array, 'name'); // throws InvalidArgumentException

See Pull Request #55567 for details.

CreatedAt and Original Delay Added to Job Payload

Taylor Otwell contributed adding the payload creation and job delay info to job payloads. The delay is the optional job delay in seconds and the createdAt is the timestamp of when the job payload is created:

$job->payload();
/*
Now includes: ['delay' => 5, 'createdAt' => 1745965273]
*/

See Pull Request #55529 for details.

Ensure Fake Job Implements the Job Contract

Tim MacDonald added the Illuminate\Contracts\Queue\Job contract to the FakeJob class used in tests to fake queue jobs:

The fake job is used in places where an implementation of the job contract is expected.

This ensures that the fake job supports strict typing of the job contract when, for example, listening for events and passing the job instance around.

See Pull Request #55574 for details.

Release notes

You can see the complete list of new features and updates below and the diff between 12.10.0 and 12.11.0 on GitHub. The following release notes are directly from the changelog:

v12.11.0

Paul Redmond photo

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

Sponsored

laravelcloud logo
Laravel Cloud

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

Visit Laravel Cloud

The latest

View all →
Agent Run Observability in Laravel AI SDK 0.11 image

Agent Run Observability in Laravel AI SDK 0.11

Read article
Debounced Queued Event Listeners in Laravel image

Debounced Queued Event Listeners in Laravel

Read article
Statamic Mailables Viewer Previews Laravel Emails in the Control Panel image

Statamic Mailables Viewer Previews Laravel Emails in the Control Panel

Read article
Laravel Tackle: Run an AI Coding Agent in Your Laravel App image

Laravel Tackle: Run an AI Coding Agent in Your Laravel App

Read article
Queue::forward(): Reroute Laravel Queues in One Place image

Queue::forward(): Reroute Laravel Queues in One Place

Read article
Laravel Read-Through Filesystem: Lazy Storage Migration image

Laravel Read-Through Filesystem: Lazy Storage Migration

Read article