Laravel 9.37 Released

Published on by

Laravel 9.37 Released image

The Laravel team released 9.37 this week along with a few patch releases between 9.37 and the release of Laravel 9.36. This week's releases added support for preloading assets with Vite, new strict violation handlers, verbose view caching CLI output, and more.

Verbose view caching

Andrew Brown contributed the ability to pass -v to the view:cache artisan command to output the directories the command is looking in and -vv to see every file the command caches.

php artisan view:cache -vv

Here's an example of what you'll see with a fresh install of Laravel 9.37:

Handlers for silently discarded and missing attributes

Aaron Francis contributed the ability to register handlers for "silently discarded" and "missing attributes" strict mode violations:

Model::handleMissingAttributeViolationUsing(
function ($model, $key) {
// ...
}
);
 
Model::handleDiscardedAttributeViolationUsing(
function ($model, $keys) {
// ...
}
);

Pass a closure for the rescue report param

@foremtehan contributed passing a callable as the $report parameter when using rescue() so you can conditionally report the error based on the boolean returned:

rescue(fn() => 'error', fn() => 'rescue', function(Throwable $e){
return $e instanceof SomeException;
});

Support preloading assets with Vite

Tim MacDonald contributed preloading of assets required for the current page load with Vite. It is now the default behavior for Laravel applications using Vite. The details of how this works is quite intricate, and I'd recommend reading the description of Pull Request #44096. Also, you can learn more about the general concepts behind preloading critical assets to improve loading speed.

Query builder raw value method

@eusonlito contributed a rawValue() method to get a value from a SQL expression. Here are some examples from the pull request:

$first = TripModel::orderBy('date_at', 'ASC')
->rawValue('YEAR(`date_at`)');
$last = TripModel::orderBy('date_at', 'DESC')
->rawValue('YEAR(`date_at`)');
 
$fullname = UserModel::where('id', $id)
->rawValue('CONCAT(`first_name`, " ", `last_name`)');

Release Notes

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

v9.37.0

Added

  • Added optional verbose output when view caching (#44673)
  • Allow passing closure to rescue $report parameter (#44710)
  • Support preloading assets with Vite (#44096)
  • Added Illuminate/Mail/Mailables/Content::htmlString() (#44703)

Fixed

  • Fixed model:show registering getAttribute() as a null accessor (#44683)
  • Fix expectations for output assertions in PendingCommand (#44723)

v9.36.4

Added

  • Added rawValue to Database Query Builder (and Eloquent as wrapper) (#44631)
  • Added TransactionCommitting (#44608)
  • Added dontIncludeSource to CliDumper and HtmlDumper (#44623)
  • Added Illuminate/Filesystem/FilesystemAdapter::checksum() (#44660)
  • Added handlers for silently discarded and missing attribute violations (#44664)

Reverted

Changed

  • Create new Json ParameterBag Instance when cloning Request (#44671)
  • Prevents booting providers when running env:decrypt (#44654)

v9.36.3

Reverted

  • Reverts micro-optimization on view events (#44653)

Fixed

  • Fixes blade not forgetting compiled views on view:clear (#44643)
  • Fixed Illuminate/Database/Eloquent/Model::offsetExists() (#44642)
  • Forget component's cache and factory between tests (#44648)

Changed

  • Bump Testbench dependencies (#44651)

v9.36.2

Fixed

  • Ensures view creators and composers are called when * is present (#44636)

v9.36.1

Fixed

  • Fixes livewire components that were using createBladeViewFromString (#pull)
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
Cut PHP Code Review Time & Bugs into Half with CodeRabbit logo

Cut PHP Code Review Time & Bugs into Half with CodeRabbit

CodeRabbit is an AI-powered code review tool that specializes in PHP and Laravel, running PHPStan and offering automated PR analysis, security checks, and custom review features while remaining free for open-source projects.

Cut PHP Code Review Time & Bugs into Half with CodeRabbit
Join the Mastering Laravel community logo

Join the Mastering Laravel community

Connect with experienced developers in a friendly, noise-free environment. Get insights, share ideas, and find support for your coding challenges. Join us today and elevate your Laravel skills!

Join the Mastering Laravel community
Laravel Idea for PhpStorm logo

Laravel Idea for PhpStorm

Ultimate PhpStorm plugin for Laravel developers, delivering lightning-fast code completion, intelligent navigation, and powerful generation tools to supercharge productivity.

Laravel Idea for PhpStorm
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
Rector logo

Rector

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

Rector
LaraJobs logo

LaraJobs

The official Laravel job board

LaraJobs
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant 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
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 →
Handling Request Data Presence in Laravel image

Handling Request Data Presence in Laravel

Read article
First Factor One-Time Passwords for Laravel with OTPZ image

First Factor One-Time Passwords for Laravel with OTPZ

Read article
Managing Request Host Information in Laravel image

Managing Request Host Information in Laravel

Read article
Tim Leland: URL Shorteners, browser extensions, and more image

Tim Leland: URL Shorteners, browser extensions, and more

Read article
HTTP Method Verification in Laravel image

HTTP Method Verification in Laravel

Read article
Packistry is a Self-hosted Composer Repository Made with Laravel image

Packistry is a Self-hosted Composer Repository Made with Laravel

Read article