Laravel 13.24 was released on August 4, 2026, bringing meaningful additions to the image API, Eloquent query builder, and validation layer — plus a performance fix that could save your app from multi-minute stalls on large payloads.
Dominant Color Detection
The first-party image API now exposes a dominantColor() method. It downsamples the image to a single pixel and returns the result as a hex string, making it ideal for placeholder backgrounds while a full image loads.
use Illuminate\Support\Facades\Image;
$color = Image::fromPath(storage_path('app/photo.jpg'))->dominantColor();
// "#8a6f4c"
The result is memoized per instance, and any pending transformations run before sampling — so you get the color of the image you are about to store, not the original. You can also pass 'dominant' as the background argument to contain() or rotate(), filling letterbox bars or rotation corners with the image's own color automatically:
Image::fromUpload($request->file('photo'))
->contain(1200, 800, background: 'dominant')
->store('photos');
HEIC and AVIF Input/Output
Previously, AVIF files were rejected on input and HEIC/HEIF were unsupported in both directions, meaning iPhone photos had to be converted before reaching the framework. Laravel 13.24 fixes this:
- AVIF, HEIC, and HEIF are now accepted as inputs.
toHeic()andoptimize('heic')are available as outputs.- All three formats are recognized by the
imagevalidation rule.
Image::fromPath(storage_path('app/photo.heic'))
->usingImagick()
->cover(1200, 800)
->toAvif()
->quality(80)
->store('photos');
Note: HEIC processing requires an Imagick build with the HEIC codec compiled in.
image/heifMIME types are normalized to.heicon storage.
modelKeys() on the Eloquent Query Builder
Eloquent collections have long had modelKeys(), but retrieving primary keys directly from a query required hardcoding pluck('id'). The query builder now supports it natively:
$ids = Post::query()->where('published', true)->modelKeys();
// [1, 2, 3]
It uses the model's qualified key name, so custom $primaryKey values and joined queries resolve correctly without any column hardcoding.
New array_keys Validation Rule
The existing Rule::array() rejects unexpected keys but reports a generic failure message. The new array_keys rule focuses solely on key constraints and provides a clearer error:
$request->validate([
'options' => Rule::arrayKeys(['sort', 'direction']),
]);
Given ['sort' => 'name', 'colour' => 'red'], the message reads: "The options field must only contain the following keys: sort, direction."
Custom messages can use :values (accepted keys) or :unexpected (the offending keys), which is especially useful in API responses:
$request->validate(
['options' => Rule::arrayKeys(['sort', 'direction'])],
['options.array_keys' => 'The :attribute field may not contain :unexpected.']
);
// The options field may not contain colour.
Wildcard Validation Performance Fix
Expanding foo.*.bar rules was quadratic in the number of expanded attributes. At 8,000 array items (roughly 1.1 MB), validation could take over 85 seconds — before a single rule ran. The fix moves the merge logic into a method that takes the accumulator by reference:
| Items | Before | After | |-------|---------|--------| | 1,000 | 0.98s | 0.11s | | 4,000 | 18.59s | 0.47s | | 8,000 | 85.13s | 0.98s |
Note that explodeWildcardRules() no longer calls mergeRulesForAttribute(), so overrides of that method will no longer affect wildcard expansion.
Key Takeaways
dominantColor()returns a hex string and works as abackgroundvalue incontain()androtate().- HEIC and AVIF are now fully supported for input and output; Imagick with the HEIC codec is required for HEIC.
modelKeys()on the query builder eliminates the need to hardcode primary key column names.- The
array_keysrule gives precise, actionable validation messages for unexpected array keys. - The wildcard validation fix reduces an 85-second stall to under 1 second for 8,000-item arrays.
Arr::forget()now correctly removes the intended keys when processing mixed dotted and top-level keys.
Source: Laravel News — Laravel 13.24.0