Laravel 12.31, weekly updates, and weekly tip

Laravel 12.31

Another minor and patch release last week jumps us to Laravel 12.31.0 this week. Here are the highlights:

  • Fix SQS FIFO and fair queue support in #57080
  • Add support for ordinal position in validation messages in #57109
  • Add Macroable trait to Illuminate/Support/Benchmark in #57107
  • Reintroduce short-hand "false" syntax for Blade component properties in #57104

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

Now with the laravelshift.com codebase all cleaned up, I'm looking into optimizations. Not code necessarily, but network performance.

I moved everything over to Cloudflare several months ago. But I haven't explored their services. They offer so much on the free plan. I want to dig into edge caching.

While I've always been a "full-stack" developer, I contracted as a "front-end" developer way back in 2008. This was after the Web 2.0 (semantic web) craze had taken hold. I actually worked in the marketing department for a Fortune 100 company.

Their goal was to rebuild the website following Web 2.0 practices with a focus on speed. At the time, following these practices and page speed factored heavily into SEO. They didn't care about these things technically. They cared about having a higher search engine ranking than their competitors.

Of course, as a developer at heart, I loved rebuilding the website with modern HTML, JavaScript, and CSS. But I also got deep into page speed. Back then, a lot of it relied on internal infrastructure or multiple services. Now, it's all available with Cloudflare.

Anyway, that's the end of storytime with old man JMac. This week I'll livestream and continue researching Cloudflare's services.

Weekly Tip

I was reminded you can pass the columns to select directly to get. The following two snippets are equivalent:

Product::select('name')->where('active', 1)->get();
Product::where('active', 1)->get('name');

select is more expressive (traditionally). get is more streamlined. Both return an instance of the model (Product) with only the selected columns hydrated (name).

Note that even though you've limited the columns, both are still pretty memory intensive. This is because each record is an instance of a class. Probably no big deal for a few hundred records. But maybe a big deal for a few thousand.

That's where pluck comes in. It returns a collection containing only the value (and optional key) of the selected column. Much more performant as it doesn't instantiate a bunch of classes. However, it is limited to 2 columns.