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

acquaintsoft logo
Acquaint Softtech

Hire Laravel developers with AI expertise at $20/hr. Get started in 48 hours.

Visit Acquaint Softtech

The latest

View all →
WhenMounted and BigInt Props in Inertia.js v3.8 image

WhenMounted and BigInt Props in Inertia.js v3.8

Read article
Postcodes for Laravel: GB Postcode Lookup and Geography Data image

Postcodes for Laravel: GB Postcode Lookup and Geography Data

Read article
Laravel 14 Adds a defaults() Method to Eloquent Models image

Laravel 14 Adds a defaults() Method to Eloquent Models

Read article
Laravel AI SDK and Laravel MCP Security Fixes: Update Now image

Laravel AI SDK and Laravel MCP Security Fixes: Update Now

Read article
Mailbox for Laravel: Preview and Test Rendered Email image

Mailbox for Laravel: Preview and Test Rendered Email

Read article
Count Worker Crashes as Job Exceptions in Laravel 13.34 image

Count Worker Crashes as Job Exceptions in Laravel 13.34

Read article