Laravel 8.28, weekly updates, and 🔥 tip

Laravel 8.28

Several new features this week as well as improved support for PHP 8.1. This gives us a minor version bump to 8.28.0.

  • Fix attribute nesting on anonymous components in #36240
  • Fix middleware group display in d9e28dc
  • Allow using dot syntax for $responseKey in #36196
  • Output full trace for HTTP errors in #36219
  • Add giveConfig for contextual binding config values in 4d37befa
  • Add custom AsArrayObject + AsCollection casts in #36245
  • Improve support for PHP 8.1 in #36254, #36264, #36262, and #36261

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 finished up the last video - Upgrading old Laravel applications. This video is 12 minutes long, but the tips within it could honestly save you 12 hours of development time when upgrading outdated Laravel applications.

This completes the set of new videos. I may redo some of the originals over the next few months so they mirror the current site design. But content-wise, they are fine for now.

A shoutout to Steve who let me use his old Laravel app in the video so I could Shift a real-world codebase. I think I may do a few more live-streams demoing this upgrade process in the future.

Jess and I continued to work on the new Tailwind 1.x Shift and Tailwind 2.x Shift. We should start beta testing these at the end of the month. Again, not too sure how many are still running old Tailwind 0.7.4 sites, but just like Laravel, there were lots of tedious upgrade steps to automate. So it'll be nice to have for those that are.

Finally, the annual Shift pricing increase will happen March 1. While this normally coincides with a Laravel release, it was always to incentivize developers to stay current. Given that all versions prior to Laravel 6 are unsupported, and have been since last August, older Shifts will join the $29 pricing tier with the rest of the unsupported versions.

So, if you're still running an unsupported version, maybe it's time to upgrade to a modern, supported version of Laravel and save a few bucks.

🔥 Tip

This one deals with the new casts added in this week's release. This was actually a gotcha I mentioned in a previous Laracon talk.

Although the built-in array cast would allow you to read values as an array, you could not write values as an array. Instead, you had to use a temporary variable, manipulate it, then reassign that to the attribute.

It was rather awkward, and unexpected.

1// did not work...
2$user->options['foo'] = 'bar';
3$user->save();

Now, in Laravel 8.28, using the AsArrayObject, this works:

1$user->options['foo'] = 'bar';
2$user->save();

With that said, there are still some gotchas with this new cast. Read through the PR for more details. Nonetheless, I believe this is better. And maybe someday will be the default behavior of the array cast.