Laravel 12.16.0 - New Features for Developers
June 3, 2025Laravel 12.16.0 - New Features for Developers
1. New Validation Rule: in_array_keys
You can now validate that an array contains at least one of the specified keys:
Validator::make($request->all(), [
'config' => 'array|in_array_keys:api_key,access_token,oauth_token',
'config.api_key' => 'nullable|string|min:32|max:64',
// ...
]);
This in_array_keys rule checks for the presence of any given key.
2. Fluent Rule Method: Rule::contains()
This gives you a cleaner and more expressive way to check array contents:
Validator::make($request->all(), [
'roles' => [
'required',
'array',
Rule::contains([Role::Admin, Role::Editor]),
],
]);
This replaces the older string-based contains: validation rule.
3. New Helper: Arr::hasAll()
use Illuminate\Support\Arr;
$array = ['name'=>'Taylor','language'=>'php'];
Arr::hasAll($array, ['name']); // true
Arr::hasAll($array, ['name','language']); // true
Arr::hasAll($array, ['name','ide']); // false
You're able to check if an array has *all* specified keys.
4. toUri() on Stringable
$sentence = 'Go to {https://euhosting.com/support} for support.';
$uri = str($sentence)->between('{','}')->toUri();
return $uri->value();
This converts a string segment into a URI object easily.
5. Additional Fixes & Enhancements
- Added option to always defer cache operations.
- Bug fixes around RedisStore, TestResponse, ResponseFactory, and more.
Blog
Jul 06, 2025
🔍 ECMAScript 2025 – Detailed Feature Guide All new ECMAScript 2025 features with code examples and explanation of their importance for front...
Jul 31, 2025
The useCallback hook in React is used to return a memoized version of a callback function, so it's only recreated when its dependencies change. The...
Jul 01, 2025
đźš« Stop Copy-Pasting Code! Ever duplicated slug logic or logging across multiple models? Laravel's Traits got your back. 1. What’s a Trait?...
Aug 06, 2025
When building applications with React, there’s always a need to manage data that changes based on user interaction or from fetching external r...
Jun 26, 2025
CSS Specificity: Cascade Layers vs BEM vs Utility Classes This article compares three approaches to managing CSS specificity — BEM, utility‑f...
Aug 09, 2025
Object-Oriented Programming (OOP) is a modern software development approach that divides an application into units called Objects that interact with...