Tinkerwell - The PHP Scratchpad

Laravel 9.37 Released

Published on by

Laravel 9.37 Released image

Never Miss a Laravel Release 🚀

Sign up and get an email with each new Laravel release

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.

image
Laravel Cloud

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

Visit Laravel Cloud
Curotec logo

Curotec

World class Laravel experts with GenAI dev skills. LATAM-based, embedded engineers that ship fast, communicate clearly, and elevate your product. No bloat, no BS.

Curotec
Bacancy logo

Bacancy

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

Bacancy
Tinkerwell logo

Tinkerwell

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

Tinkerwell
Get expert guidance in a few days with a Laravel code review logo

Get expert guidance in a few days with a Laravel code review

Expert code review! Get clear, practical feedback from two Laravel devs with 10+ years of experience helping teams build better apps.

Get expert guidance in a few days with a Laravel code review
PhpStorm logo

PhpStorm

The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

PhpStorm
Laravel Cloud logo

Laravel Cloud

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

Laravel Cloud
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
Harpoon: Next generation time tracking and invoicing logo

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing
Lucky Media logo

Lucky Media

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

Lucky Media
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

The latest

View all →
`hasSole()` Collection Method in Laravel 12.49.0 image

`hasSole()` Collection Method in Laravel 12.49.0

Read article
Install Laravel Package Guidelines and Skills in Boost image

Install Laravel Package Guidelines and Skills in Boost

Read article
Bagisto Visual: Theme Framework with Visual Editor for Laravel E-commerce image

Bagisto Visual: Theme Framework with Visual Editor for Laravel E-commerce

Read article
Clawdbot Rebrands to Moltbot After Trademark Request From Anthropic image

Clawdbot Rebrands to Moltbot After Trademark Request From Anthropic

Read article
Automate Laravel Herd Worktrees with This Claude Code Skill image

Automate Laravel Herd Worktrees with This Claude Code Skill

Read article
Laravel Boost v2.0 Released with Skills Support image

Laravel Boost v2.0 Released with Skills Support

Read article