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

acquaintsoft logo
Acquaint Softtech

Hire Laravel developers with AI expertise at $20/hr. Get started in 48 hours.

Visit Acquaint Softtech

The latest

View all →
Laravel monitoring that doesn't bill you by your traffic image

Laravel monitoring that doesn't bill you by your traffic

Read article
Mock PHP Classes in Tests With the Double Library image

Mock PHP Classes in Tests With the Double Library

Read article
Laravel Discount: Coupon Codes, Usage Limits, and Stacking image

Laravel Discount: Coupon Codes, Usage Limits, and Stacking

Read article
Laravel Truss: Live Interactive Database ER Diagrams image

Laravel Truss: Live Interactive Database ER Diagrams

Read article
Laravel artisan dev: Run Server, Queue, Logs, and Vite image

Laravel artisan dev: Run Server, Queue, Logs, and Vite

Read article
Validate and Convert HEIC Images in Laravel image

Validate and Convert HEIC Images in Laravel

Read article