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
Stringable
instances. - New
--batched
option forphp artisan make:job
to generate batchable jobs. UsePolicy
attribute 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
Efficient Reporting & Big Data Reports with Queues
Jul 07, 2025
How to cache report queries with fixed timelines How to generate large reports asynchronously using job queues 1. 🧠 Report Query Caching wi...
Comparison between Scopes + Traits × UseEloquentBuilder in Laravel
Jul 13, 2025
Laravel provides multiple ways to write reusable query logic. The two most common approaches are using Scopes with Traits or the newer #[UseEloquentBu...
Laravel 12.21.0 – A Smart Update for Cleaner Queries and Stricter Validation
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...
Object-Oriented Programming (OOP) – Core Concepts
Aug 09, 2025
Object-Oriented Programming (OOP) is a modern software development approach that divides an application into units called Objects that interact with...
Mastering Laravel Context: Advanced Logging and Contextual Job Tracing
Jul 20, 2025
Laravel Context is one of the most powerful new features in Laravel 12. It allows you to attach contextual data (like user ID, IP address, request pat...
What’s New in ECMAScript 2025
Jun 30, 2025
What’s New in ECMAScript 2025 On June 25, 2025, Ecma International officially approved ES2025, adding several useful features: 1. 📦 Import At...
