Cache::flexible()
use Illuminate\Support\Facades\Cache;
// Cache stampede protection with probabilistic early expiration
$value = Cache::flexible("expensive_data", [30, 60], function () {
return expensiveComputation();
});
// [30, 60] = stale after 30s, recalculated by one process at random up to 60s
Cache::memo()
// Memoize function results for the current request
$result = Cache::memo("user_".$id, function () use ($id) {
return User::with("posts")->find($id);
}, $seconds = 3600);
Number & Str Helpers
use Illuminate\Support\Number;
// Number helpers
echo Number::format(1234567); // 1,234,567
echo Number::percentage(75); // 75%
echo Number::currency(1000); // $1,000.00
echo Number::fileSize(1048576); // 1 MB
// Str improvements
echo str(" Hello ")->inlineMarkdown(); // <p>Hello</p>
echo str()->isUrl("https://laravel.com"); // true
New Artisan Commands
// php artisan config:show app.name
// php artisan make:class SomeClass
// php artisan make:enum Status
// php artisan make:interface Logger
// php artisan make:trait Timestampable
Model Attributes
// Laravel 13: #[Fillable] replaces $fillable
// Laravel 13: #[Appends] replaces $appends
// Laravel 13: #[UseResource] replaces toResource()
// Laravel 13: #[ScopedBy] replaces addGlobalScope()