Laravel 11.12, weekly updates, and 🔥 tip

Laravel 11.12

Late tag today brings us to Laravel 11.12. Here are the highlights.

  • Ensure schema:dump will dump the migrations table only if it exists in #51827
  • Improve assertion error messages in #51846
  • Add multiply to Collection in #51870
  • Add addEventDiscoveryPaths to EventServiceProvider in #51896

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 live streamed patching a tiny, tiny paper cut I've encountered over the years - the artisan make commands can duplicate the .php extension. I wouldn't call it a highlight, but it was merged.

With the remainder of the week, I continued to backport more features I added in the Laravel 11.x Shift to previous Shifts. These included things like loose comparison of the core files and preserving any file headers (like import and declare statements).

I then moved on to slimming the language files. The language files were actually removed in Laravel 10. Similar to the configuration files in Laravel 11, the framework now includes the language files and recursively merges any of your customizations. So if you don't have any customizations, you don't need these files. Otherwise, you only need to set the keys you customize.

Again, similar to the configuration files, these are constantly changing with new validation messages and minor grammatical tweaks. So slimming them continues to reduces the maintenance footprint of your application.

This week is a bit of a wash as I'm on point with the girls since Ashley is out of town. I hope to live stream tomorrow to build a blog for Shift. I feel there are a lot of technical details I could cover that are too long for this newsletter, but perfect for a short blog post. I don't know. Let me know if that sounds interesting to you.

🔥 Tip

Something I've mentioned before in this newsletter, but recycled on Twitter recently was the direct use of PHP's array functions. Collections are awesome, but PHP comes with nearly 100 built-in array functions.

This makes wrapping something in a collection just to perform a single action, then convert back to an array seem like the long way around.

For example, consider the following lookup array:

$lookup = collect($locations)->pluck('name', 'id')->all()

Now instead using the native PHP function:

$lookup = array_column($locations, 'name', 'id');

Again, once the logic becomes complex or you need to use multiple methods, collections immediately start to hold their weight. But for the simple stuff, PHP's probably got it.