Laravel 8.52, weekly updates, and πŸ”₯ tip

Laravel 8.52

Lots of features this week bringing Laravel to 8.52.0. Here are the highlights:

  • Allow shift() and pop() to take multiple items from a collection in #38093
  • BelongsToMany->sync() will respect touching for pivots when the result contains detached items in #38085
  • Ability to specify the broadcaster to use when broadcasting an event in #38086
  • Add developer friendly message if no Prunable models are found in #38108
  • Password Validator inherits custom error message and attribute in #38114
  • Add ignoreTrashed to Unique validation rule in #38124
  • Support for job middleware on queued listeners in #38128
  • Add broadcastWith() and broadcastAs() support in #38137

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 completed most of the Human Shifts which came in. I have a bit left on one of them as it was a large application coming from Laravel 4.2.

After these I had some time to continue working on the Shift to upgrade a PHP CS Fixer config from version 2 to version 3. I started this in a live stream two weeks ago and thought I could finish it over the weekend. However, understanding all the changes and parsing the various styles of a configuration file has, of course, taken longer than I expected.

I managed to write a few failing tests and may try to make them pass in a live steam tomorrow. Ultimately this will be a free shift, so there's no rush. But I want to upgrade Shift to use PHP CS Fixer v3, and want to ensure I give users an automated upgrade path.

πŸ”₯ Tip

Not really a tip this week so much as a question.

When I was working on the Shift for PHP CS Fixer, I had a need to split a string value into key value pairs. I was surprised there wasn't a cleaner way to do this. At least not one I could find.

Basically, I wanted to split the following:

1config-1:option-1,config-2:option-2,config-3:option-3

Into:

1[
2 'config-1' => 'option-1',
3 'config-2' => 'option-2',
4 'config-3' => 'option-3',
5];

I ended up just using foreach and explode to build the array myself. But wondered if some combination of chunk and zip, or other collection methods could work. So, let me know if you have a πŸ”₯ way to do this…