Laravel 10.19, weekly updates, and 🔥 tip

Laravel 10.19

Lots of new methods and attributes this week brings us to Laravel 10.19. Here are the highlights:

  • Add wordWrap to Str in #48012
  • Fix assertRedirectToRoute when route uri is empty in #48023
  • Fix forced use of write DB connection in #48015
  • Add ability to customize class resolution in event discovery in #48031
  • Add percentage to Collections in #48034
  • Allow Listeners to dynamically specify delay using withDelay in #48026
  • Add optional count parameter to createMany and createManyQuietly in #48048
  • Add attributes support on default component slot in #48039
  • Add WithoutRelations attribute for model serialization in #47989

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 got all the outstanding Human Shifts in a reviewable place. Still a fair amount of work to do though. As any Laravel upgrade, packages are the main challenge. Even more so for upgrading older Laravel applications as you need to upgrade multiple major versions, or the package is abandoned.

I didn't get to the mid-cycle Shift last week. I hope to later this week. Instead, I had some momentum on the Shift CLI. So I continued to focus on it. The Shift CLI will be the replacement for the Workbench desktop app. I hope to release an alpha of the free tasks available next week, and the premium tasks the following week.

🔥 Tip

In the process of upgrading one of the Laravel applications, I came across an incompatibility between regular expression in PHP 8. Prior versions of PHP "handled" dashes (-) used within character classes in undefined ways. PHP 8 now throws an error.

For example, the pattern [a-:] means all ASCII characters from lowercase a to :. Most developers probably mean for this to only be a, -, or :. The issue, is when using character class shorthands with dashes in a pattern like [\w-:].

So, unless you want a character range, be sure to escape dashes within a character class. Or, to be a real pro, include the - last and you don't need to escape it.