Laravel 9.34 Released

Published on by

Laravel 9.34 Released image

The Laravel team released 9.33 and 9.34, introducing Laravel Precognition, short attribute syntax for self-closing blade components, and more.

Note: we are also covering key new features released in Laravel 9.33, released last Friday between the typical weekly release.

Laravel Precognition (9.33)

Tim MacDonald contributed the introduction of Precognition. While a full explanation of out of the scope of this article, check out Pull Request #44339 for a deep description of what Precognition offers. In summary, here's the TLDR:

Precognition is a new framework feature that will allow developers to create new and improved experiences for their users.

Precognition introduces a request / response header, middleware, and for some cases a global helper that Laravel reacts to in a unique manner.

When a Precognition request comes into Laravel, everything right up until the controller is executed. This includes all middleware, route model binding resolution, form request validation etc.

You should really read Pull Request #44339 to see examples of how you might utilize this exciting new feature!

Short attribute syntax for self-closing blade components (9.34)

Perry van der Meer contributed the short attribute syntax to self-closing blade components. This PR builds on the short attribute syntax released in Laravel 9.32 for Blade components:

<!-- current short syntax -->
<x-profile :$userId></x-profile>
 
<!-- short syntax for self-closing component -->
<x-profile :$userId/>

Render PHP's "BackedEnum" in Blade views (9.34)

Nuno Maduro contributed Blade rendering support for backed enums. Take the following route view example:

// routes/web.php
Route::get('/', function () {
return view('dashboard', ['role' => UserRoles:: ADMIN]);
});

Given the $role variable, it will be rendered properly in Blade now:

Hello, {{ $role }}.
 
<!-- ❌ Before: TypeError: htmlspecialchars(): Argument #1 ($string) must be of type string -->
<!-- ✅ After: Hello, Admin. -->

Add cc() method to MailFake (9.33)

Adrian Nürnberger contributed the missing cc() method to mail fakes. The implementation is as follows:

public function cc($users)
{
return (new PendingMailFake($this))->cc($users);
}

Ignore case in Stringable contains() and containsAll() (9.33)

Jae Toole contributed case-insensitive support to Stringable contains() and containsAll() methods:

// returns true
$this->stringable('taylor')
->contains(['LOR'], true);
 
// returns true
$this->stringable('taylor otwell')
->containsAll(['TAYLOR', 'OTWELL'], true);

Release Notes

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

v9.34.0

Added

  • Short attribute syntax for Self Closing Blade Components (#44413)
  • Adds support for PHP's BackedEnum to be "rendered" on blade views (#44445)

Fixed

  • Fixed Precognition headers for Symfony responses (#44424)
  • Allow to create databases with dots (#44436)
  • Fixes dd source on windows (#44451)

Changed

  • Adds error output to db command when missing host (#44394)
  • Changed Illuminate/Database/Schema/ForeignIdColumnDefinition::constrained() (#44425)
  • Allow maintenance mode events to be listened to in closure based listeners (#44417)
  • Allow factories to recycle multiple models of a given typ (#44328)
  • Improves dd clickable link on multiple editors and docker environments (#44406)

v9.33.0

Added

  • Added Illuminate/Support/Testing/Fakes/MailFake::cc() (#44319)
  • Added Ignore Case of Str::contains and Str::containsAll to Stringable contains and containsAll (#44369)
  • Added missing morphs methods for the ULID support (#44364)
  • Introduce Laravel Precognition (#44339)
  • Added Illuminate/Routing/Route::flushController() (#44386)

Fixed

  • Fixes memory leak on PHPUnit's Annotations registry (#44324, #44336)
  • Fixed Illuminate/Filesystem/FilesystemAdapter::url() with config prefix (#44330)
  • Fixed the "Implicit conversion from float to int loses precision" error in Timebox Class (#44357)

Changed

  • Improves dd source on compiled views (#44347)
  • Only prints source on dd calls from dump.php (#44367)
  • Ensures a Carbon version that supports PHP 8.2 (#44374)
Paul Redmond photo

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

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.

Laravel Forge logo

Laravel Forge

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

Laravel Forge
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
No Compromises logo

No Compromises

Joel and Aaron, the two seasoned devs from the No Compromises podcast, are now available to hire for your Laravel project. ⬧ Flat rate of $7500/mo. ⬧ No lengthy sales process. ⬧ No contracts. ⬧ 100% money back guarantee.

No Compromises
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Bacancy logo

Bacancy

Supercharge your project with a seasoned Laravel developer with 4-6 years of experience for just $2500/month. Get 160 hours of dedicated expertise & a risk-free 15-day trial. Schedule a call now!

Bacancy
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
Lunar: Laravel E-Commerce logo

Lunar: Laravel E-Commerce

E-Commerce for Laravel. An open-source package that brings the power of modern headless e-commerce functionality to Laravel.

Lunar: Laravel E-Commerce
LaraJobs logo

LaraJobs

The official Laravel job board

LaraJobs
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
Rector logo

Rector

Your partner for seamless Laravel upgrades, cutting costs, and accelerating innovation for successful companies

Rector
MongoDB logo

MongoDB

Enhance your PHP applications with the powerful integration of MongoDB and Laravel, empowering developers to build applications with ease and efficiency. Support transactional, search, analytics and mobile use cases while using the familiar Eloquent APIs. Discover how MongoDB's flexible, modern database can transform your Laravel applications.

MongoDB

The latest

View all →
Add Comments to your Laravel Application with the Commenter Package image

Add Comments to your Laravel Application with the Commenter Package

Read article
Laravel Advanced String Package image

Laravel Advanced String Package

Read article
Take the Annual State of Laravel 2024 Survey image

Take the Annual State of Laravel 2024 Survey

Read article
Upload Files Using Filepond in Livewire Components image

Upload Files Using Filepond in Livewire Components

Read article
The Best Laravel Tutorials and Resources for Developers image

The Best Laravel Tutorials and Resources for Developers

Read article
Introducing Built with Laravel image

Introducing Built with Laravel

Read article