Laravel 11.35, weekly updates, and deals

Laravel 11.35

Got a minor release this week bringing us to Laravel 11.35. Here are the highlights:

  • Allow sorting routes by precedence for routes:list in #53706
  • Add the pivot's related model when creating from attributes in #53694
  • Improve Collection support for enums using firstWhere() and value() in #53777
  • Add Conditionable trait to Request in #53775
  • Ability to transform Http\Client\Response into Fluent in #53771
  • Ability to customize or disable Http\Client\RequestException message truncation in #53734
  • Add pingOnSuccessIf to pingOnFailureIf to Schedule in #53795
  • Introducing Uri helper in #53731

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 JT and I finished up our side-project and quietly deployed things to production. We're doing some internal testing this week. Over the next few weeks, we'll try to get some beta testers. Given the holidays, we'll probably wait until after the New Year to officially launch.

A Human Shift came in at the end of last week. I was able to upgrade it from 5.5 to 11.x pretty quickly. One of the reasons was the project did not have that many dependencies. While a medium sized project, it pretty much did everything using what Laravel provided.

Packages are everywhere. Heck, Spatie has hundreds of packages. But remember - once you add a package to your project, you are responsible for that code. Sure, someone else authored it. But they aren't going to maintain their code within your app. That's on you. Forever and ever.

Anyway, with the rest of the week I made some tweaks to Shift and laravelshift.com. I also did some off-stream work on generating Livewire components with Blueprint. A beta of this feature is pretty much done. So I really hope to open a PR in my next livestream.

Weekly Tip

I saw a cool PR. It proposed a new extract method for Stringables. Essentially a more usable alternative to regular expressions for capturing simple patterns in a string.

For example:

// ['last_4' => '5000']
Str::extract(
'4242-4242-4242-5000',
'*-*-*-{last_4}'
);

This method simply wraps regular expressions. As such, it faces the same challenges as regular expressions. This led to a lot of comments on its behavior and ultimately the PR getting closed.

Although I tried to support the PR, the issues came down to greediness and escaping. To demonstrate an issue, we can flip the example above to extract the first 4 digits instead.

// ['last_4' => '4']
Str::extract(
'4242-4242-4242-5000',
'{first_4}*'
);

There were other issues too. I think all of this is solvable with rules. Defining what needs to be escaped in the pattern (if anything), and make it very clear that placeholders match as much as possible (greedy).

As someone who loves regular expressions and does a lot of pattern matching, I'll probably revive this. Maybe in my laravel-additions package I've been considering after my own PRs were closed.