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 →
PayZephyr: One Payment API for Stripe, Paystack, and PayPal image

PayZephyr: One Payment API for Stripe, Paystack, and PayPal

Read article
Bifrost Turns One With AI Builds and New Workflows image

Bifrost Turns One With AI Builds and New Workflows

Read article
Preview Blade Templates in macOS Finder with Quick Blade image

Preview Blade Templates in macOS Finder with Quick Blade

Read article
Artisan Debugging Commands in Laravel Telescope 5.24.0 image

Artisan Debugging Commands in Laravel Telescope 5.24.0

Read article
Queue totalSize() and JobInterrupted Event in Laravel 13.31 image

Queue totalSize() and JobInterrupted Event in Laravel 13.31

Read article
Find Unexpected Test Inputs with Fuzz for Pest image

Find Unexpected Test Inputs with Fuzz for Pest

Read article