Laravel 11.16, weekly updates, and 🔥 tip
Laravel 11.16
Yesterday Laravel 11.16 was released. Here are some highlights:
- Allow passing Enum casts to
Rule::enum()
in #52073 - Ability to configure SQLite
busy_timeout
,journal_mode
, andsynchronous
pragmas in #52052 - Allow view content dependent mail callbacks in #51990
- Allow packages to replace configs recursively in #52087
- Add
success
console output in #52112 - Allow passing email address to
assertSent
in #52083
You may review the full branch diff on GitHub for a complete list of changes.
This version bump and update is automated for subscribers to a Shifty Plan. If you don't have one of those, be sure to bump your constraint and run composer update
to get the latest features.
Weekly Journal
Last week I live streamed adding the ability to pass Mail::assertSent
an email address (or multiple) instead of a closure. As highlighted, this was merged, with its assertNotSent
, assertQueued
, and assertNotQueued
counterparts.
Thursday I had an old client reach out with an immediate need to upgrade their infastructure. They were running an old Laravel and PHP version. I decided to turn that into a series of streams each day this week. We initially upgraded it Monday (using Shift). Yesterday and today I wrote some tests. Tomorrow I'll set up CI and do some refactoring Friday.
Another Human Shift came in today. I'll use the remainder of this week to get that application upgraded as well. Always fun not only upgrade old Laravel applications, but to do so with Shift.
I still need to rerecord some of the Shift videos to reflect the latest site design and Laravel versions. Hopefully I'll get to that next week.
🔥 Tip
To elaborate on the new additions to assertSent
, here are the before and after. Previously, to check if a mailable was sent to a particular email address, you had to wrap the logic in a closure.
1Mail::assertSent(MeetingMinutes::class, fn ($mail) => $mail->hasTo($user->email));
Now you may simply pass the email address as the second argument.
1Mail::assertSentTo(MeetingMinutes::class, $user->email);
There's a bit of nuance when passing an array of email addresses. This allows you to check that a particular mailable was sent to each address. This could be a single mailable sent to all addresses, or multiple mailables sent to each address.