News

Laravel 10.35 Released

Published
Laravel 10.35 Released image

Release updates

Never miss a Laravel release

Get an email whenever a new Laravel release lands.

The Laravel team released v10.35 with a Blade @use directive, a number abbreviation helper, the ability to generate a secret with artisan down, and more. Here is a bit more info about the new features introduced this week:

Add a Blade @use() directive

Simon Hamp contributed a @use() directive to import a PHP class into a Blade template without using raw PHP tags:

{{-- Before --}}
@php
use \App\Enums\WidgetStatusEnum as Status;
@endphp
 
{{-- After --}}
@use('App\Enums\WidgetStatusEnum', 'Status')
@use('App\Models\Bar')
 
{{ Status::Foo }}
{{ Bar::first() }}

Abbreviate a number with the Number::abbreviate() method

@jcsoriano contributed a Number::abbreviate() class to the newly added Number Class, which provides a human-readable abbreviated number:

Number::abbreviate(1_000_000); // "1M"
Number::abbreviate(100_001); // "100K"
Number::abbreviate(100_100); // "100K"
Number::abbreviate(99_999); // "100K"
Number::abbreviate(99_499); // "99K"

Add the --with-secret option to the artisan down command

Jacob Daniel Prunkl contributed a --with-secret option to the artisan down command that will generate a secret phrase that can be used to bypass maintenance mode so the user doesn't have to define one themselves:

Add Conditionable trait to the AssertableJson class

Khalil Laleh contributed adding the Conditionable trait to the AssertableJson class, to make it possible to assert based on a given conditional:

// Before
$response->assertJson(function (AssertableJson $json) use ($condition) {
$json->has('data');
 
if ($condition) {
$json->has('meta');
}
 
$json->etc();
});
 
// After
$response
->assertJson(fn (AssertableJson $json) => $json->has('data'))
->when($condition, fn (AssertableJson $json) => $json->has('meta'))
// ...
;

Release notes

You can see the complete list of new features and updates below and the diff between 10.34.0 and 10.35.0 on GitHub. The following release notes are directly from the changelog:

v10.35.0

Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Sponsored

laravelcloud logo
Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Visit Laravel Cloud

The latest

View all →
CPX: The Composer Package Executor for PHP image

CPX: The Composer Package Executor for PHP

Read article
Laravel AI SDK Adds Human-in-the-Loop Tool Approval image

Laravel AI SDK Adds Human-in-the-Loop Tool Approval

Read article
Pest 5 Released With Test Impact Analysis, Agent Verification, and Evals image

Pest 5 Released With Test Impact Analysis, Agent Verification, and Evals

Read article
Queue-SQL: Run Mass Deletes and Updates Across Parallel Queue Jobs image

Queue-SQL: Run Mass Deletes and Updates Across Parallel Queue Jobs

Read article
Blade Formatting in Laravel Pint image

Blade Formatting in Laravel Pint

Read article
Inertia DevTools Is Now on the Chrome Web Store image

Inertia DevTools Is Now on the Chrome Web Store

Read article