Laravel 12.18.0 Update
June 17, 2025Laravel 12.18.0 Update
The Laravel team released version 12.18.0 with several cool updates:
- String encrypt() & decrypt() helpers are now available on
Stringableinstances. - New
--batchedoption forphp artisan make:jobto generate batchable jobs. UsePolicyattribute to explicitly specify a model’s policy.- Per-request HTTP client exception truncation control.
π 1. String encrypt/decrypt helpers
Instead of doing this:
// Before
$encryptedToken = str('secret-api-token')
->pipe(fn(Stringable $str) => encrypt($str->value()))
->prepend('encrypted:')
->append(':end');
// After
$encryptedToken = str('secret-api-token')
->encrypt()
->prepend('encrypted:')
->append(':end');
It’s much cleaner and fluent now.
βοΈ 2. Batchable job option
Needed a batchable job? Now you can just run:
php artisan make:job ProcessPodcast --batched
The generated class looks like this:
namespace App\Jobs;
use Illuminate\Bus\Batchable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Queue\Queueable;
class ProcessPodcast implements ShouldQueue
{
use Batchable, Queueable;
public function handle(): void
{
if ($this->batch()->cancelled()) {
return;
}
// your processing logic here...
}
}
π·οΈ 3. UsePolicy attribute
Now you can explicitly assign a policy:
#[UsePolicy(PostPolicy::class)]
class Post extends Model {}
No need to rely solely on convention.
π 4. HTTP client truncate exception limit
Control exactly how much of the exception response gets truncated per-call:
Http::truncateExceptionsAt(240)->post(/* ... */)
That’s the major highlights from Laravel 12.18.0. Check out the full changelog or GitHub diff to explore the rest.
Blog
Jun 26, 2025
Color Everything in CSS – Simple Guide Today we’re diving into CSS colors: how to define them, especially with modern methods like lab(...
Jul 20, 2025
A detailed, example-rich guide to avoid slowdowns in Laravel apps by optimizing data retrieval and employing indexing smartly. 1. π§ Fetch Only...
Jul 16, 2025
π Mastering Modern CSS: The Power of if(), Popover Hints, and Smart Styling CSS is getting smarter. In this guide, we’ll explore how the new...
Jul 07, 2025
Laravel 12.19: Elegant Query Builders with PHP Attributes In Laravelβ―12.19, you can now use the #[UseEloquentBuilder] PHP attribute to assign a cus...
Aug 03, 2025
Laravel 12.21.0 introduces two game-changing features aimed at writing cleaner, more maintainable code. The update includes the new whereValueBetwe...
Jun 03, 2025
Laravel 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...