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

Full stack web developer. Author of Lumen Programming Guide and Docker for PHP Developers.

Cube

Laravel Newsletter

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

image
Laravel Forge

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

Visit Laravel Forge

The latest

View all →
Announcing Laravel Pulse - A New Performance Monitoring Tool for Laravel Apps image

Announcing Laravel Pulse - A New Performance Monitoring Tool for Laravel Apps

Read article
Use Ollama LLM Models Locally with Laravel image

Use Ollama LLM Models Locally with Laravel

Read article
TallStackUI - a new component library for TALL Stack apps image

TallStackUI - a new component library for TALL Stack apps

Read article
Laravel 10.34 Released image

Laravel 10.34 Released

Read article
Laravel Tailwind Merge image

Laravel Tailwind Merge

Read article
Generate Validation Rules from a Database Schema in Laravel image

Generate Validation Rules from a Database Schema in Laravel

Read article
Honeybadger logo

Honeybadger

Zero-instrumentation, 360 degree coverage of errors, outages and service degradation.

Honeybadger
Laravel Forge logo

Laravel Forge

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

Laravel Forge
Oh Dear logo

Oh Dear

Oh Dear is the best all-in-one monitoring tool for all your Laravel apps.

Oh Dear
Tinkerwell logo

Tinkerwell

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

Tinkerwell
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
LoadForge logo

LoadForge

Easy, affordable load testing and stress tests for websites, APIs and databases.

LoadForge
Paragraph logo

Paragraph

Manage your Laravel app as if it was a CMS – edit any text on any page or in any email without touching Blade or language files.

Paragraph
Lucky Media logo

Lucky Media

Bespoke software solutions built for your business. Partner with Lucky Media, your favorite Laravel Development Agency!

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