What’s New in Laravel 8.64? Explore the @aware Blade Directive and Fresh Helpers

Laravel 8.64 introduces the @aware Blade directive for accessing parent component data, adds new Stringable stripTags, lang_path, throwIf, and hasAny methods, and lists numerous framework enhancements and bug fixes in its release notes.

21CTO
21CTO
21CTO
What’s New in Laravel 8.64? Explore the @aware Blade Directive and Fresh Helpers

Laravel 8.64 has been released, bringing several new features and improvements to the framework.

@aware Blade Directive

The new @aware directive allows child components to easily access data from their parent components when needed.

<!-- Example usage -->
<x-menu color="purple">
    <x-menu.item>...</x-menu.item>
    <x-menu.item>...</x-menu.item>
</x-menu>

<!-- Implementation in resources/views/components/menu/index.blade.php -->
@props(['color' => 'gray'])
<ul {{ $attributes->merge(['class' => 'bg-'.$color.'-200']) }}>
    {{ $slot }}
</ul>

StripTags Stringable Method

Craig Anderson contributed a stripTags() method for the Stringable class, which utilizes PHP’s strip_tags() as part of string chain handling.

Str::of('<strong>before<strong><br />after')->stripTags();

lang_path Helper Function

Rodolfo Ruiz added a lang_path() helper that locates the lang directory in a Laravel project, checking both the project root and the resources folder.

// PROJECT_DIR/resources/lang or PROJECT_DIR/lang
$langPath = lang_path();

// PROJECT_DIR/resources/lang/es or PROJECT_DIR/lang/es
$langPath = lang_path('es');

// PROJECT_DIR/resources/lang/en or PROJECT_DIR/lang/en
$langPath = lang_path('en');

"throwIf" HTTP Client Method

Ahmad Mayahi contributed a throwIf() method for the HTTP client that throws an exception when a given boolean condition is true.

$response
    ->json()
    ->throwIf(App::isProduction);

hasAny Collection Method

Craig Anderson also added a hasAny() method to collections, returning true if the collection contains any of the supplied values.

// returns `true`
collect(['first' => 'Hello', 'second' => 'World'])
    ->hasAny(['first', 'fourth']);

// returns `false`
collect(['first' => 'Hello', 'second' => 'World'])
    ->hasAny(['third', 'fourth']);

Laravel v8.64.0 Release Features

Added reduceMany to collections (#39078)

Added Illuminate\Support\Stringable::stripTags() (#39098)

Added Illuminate\Console\OutputStyle::getOutput() (#39099)

Added lang_path helper (#39103)

Added @aware Blade directive (#39100)

Dispatched new JobRetrying event (#39097)

Added throwIf method to client responses (#39148)

Added Illuminate\Collections\Collection::hasAny() (#39155)

Fixed unprefixed route groups on PHP 8.1 (#39115)

Fixed token handling code in InteractsWithInput (#39150)

Refactored Illuminate\Log\LogManager::prepareHandler() (#39093)

Refreshed component state after view rendering (04fc7c2)

Ignored tablespace in dumps (#39126)

Updated SchemaState process to remove timeouts (#39139)

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

BackendPHPLaravelRelease NotesBlade
21CTO
Written by

21CTO

21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.