Laravel 8.36, weekly updates, and 🔥 tip
Laravel 8.36
There was a patch release last week for 8.35.1. This week we have a few fixes, new additions, and most importantly tweaks for today's beta release of Laravel Octane. So Laravel bumps to 8.36.0.
Here are the highlights:
- Fix
useCurrentOnUpdate
for MySQL datetime columns in #36817 - Fix Blade compiler regex issue in #36843
- Add
dispatch_sync
helper and deprecatedispatch_now
in #36835, #36834 - Allowing skipping
TransformRequests
middleware in #36856 - Add
type
option tomake:controller
in #36853 - Add exception accessor to HTTP client in #36879
- Add
unfinished
option toqueue:prune-batches
in #36877
You may review the full branch diff on GitHub for a complete list of changes.
This minor 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 focused mostly on a "mid cycle" Shift. Laravel has continued to make changes to the core files. Normally this is not an issue since there aren't many significant changes. Furthermore, with a 6 month release cycle, these didn't accumulate to a critical mass.
Again, these changes are listed as optional. But too often I've seen a single missing line in a configuration file or new middleware cost developers hours of head scratching when attempting to use new features or packages.
In addition, now that Laravel has moved to an annual release cycle, more has been pushed into Laravel 8. As such it gave me an opportunity to create the first "mid cycle" Shift which I ran last week for all subscribers to a Shifty Plan.
Of course, the Laravel 8.x Shift is continually updated. So if you ran this recently, it includes all of these changes already. If you want to double check, you may view the full set of changes since release.
With Laravel's new annual release cycle, I may offer this Shift as an add-on if enough changes are made throughout the year.
This week Jess and I will be dogfooding the new Tailwind Shifts in an effort to upgrade laravelshift.com. It currently uses Tailwind 1.x with Tailwind UI and some additional plugins. So it'll be a great opportunity to not only upgrade the site, but give these Shifts a final test. After which, we'll probably take the Tailwind Shifts out of beta.
🔥 Tip
The 🔥 tip from last week resulted in a few replies regarding the method name, with suggestions such as paidStatusesExcept
, paidExcluding
, paidWithout
.
All of which are good names. Especially that last one as it is symmetrical with Laravel's naming. But two things keep me from using them.
First, these names confuse the primary use of this method - which is to filter by paid statuses. So now all the places I call this method without the argument become paidWithout()
. Which is clumsy.
Second, I like to leverage all of the surrounding context when choosing a method name. In this case, the optional argument of the statuses to exclude. Some IDEs may type hint this name already. But with PHP 8, I could use named arguments which would explicitly communicate the intent. For example:
1$orders->paid(exclude: Order::STATUS_PENDING);
I talk a lot about naming in BaseCode and BaseLaravel. Jess and I also touched up this in our last episode of The BaseCode Podcast. So, check out those resources for a deeper dive.