Craft 5 Released

chris’s headshot By Chris, 1 Apr 2024

It’s finally here, and boy, are we excited! 692 days after Craft 4, Pixel & Tonic have done it again and shipped Craft 5. That might sound like a long time to wait between versions, but we’ve been treated to generous point releases and new things along the way. Version 5 brings along a host of new features and some big under-the-hood changes, which definitely warranted a major bump.

Edit Entry page in Craft 5

With an updated authoring experience, revised content modeling, and an improved developer experience, it’s the biggest and most ambitious update yet. We thought we’d take a closer look at some of our favourite new features.

Nested Matrix Blocks

One of the trickiest things to model in a sane way has always been nested content. Slideshows are a classic example of this. The Slideshow block sits at the top level of the entry, and maybe it has some fields for options around autoplay, etc., but then where do we add our actual slides? We previously relied heavily on the Neo plugin to give us this functionality, but now, thanks to Craft 5, we can achieve this with nested Matrix blocks. We’re able to remove a plugin dependency and be happy knowing things are first-party supported. This is a big one, and one we've wanted for a long time.

Matrix is more powerful than ever, giving us nested entries instead of blocks, and we can now change the way content is displayed using cards, entry lists, or the classic blocks view mode to show more complex content clearly.

Passkeys

Passkeys are a relatively new authentication technology used as a replacement for passwords. They're faster to sign in with, easier to use and much more secure.

As an agency, we’re always jumping between projects, sometimes working on sites we’ve inherited and didn’t build. Knowing where (we always like to customize the Control Panel trigger) and how (Is it email or username? Is it admin or something else?) to log in is always a bit of a dance. Once we’re ready to log in, though, Passkeys get us in quicker and safer than before, and of course, our clients get increased security and convenience too. We’re big on security (we even built a plugin called Nag to alert of unauthorized logins), and this new Craft 5 feature makes us feel great about continuing to recommend Craft to our clients.

New Fields and Field Instances

Modeling content in the most elegant way is a skill we enjoy flexing. Craft gives us unlimited versatility, but slicing and dicing information so it makes sense to our clients is the hard bit. With new fields for Addresses and Icons, we’ve got a couple more native ways to store content in the most suitable way possible. Being able to reuse custom fields in the same field layout – each with its own name, handle, instructions, and conditions is a game changer too.

Lazy Eager-Loading

Performance is always in the back of our minds when working on new projects. When launching a new website, we may not anticipate huge traffic in the early days, but we will still build to scale. Craft has helped us optimize database calls via the .with param for a while, telling Craft which related or nested elements we need in advance, reducing the number of queries needed.

This was great, but managing on large-scale sites would often get unwieldy. Craft 5 remedies this with new Lazy Eager-Loading; it’s a query param (.eagerly) as before, but it’s used on the downstream (nested) element queries, not on the main root query. Craft is able to evaluate this logic and fetch a set of elements as though they had been eagerly loaded up front.

So long Craft 4

Each new major version of Craft comes with two years of active support and maintenance, after which it receives critical security fixes (where possible) for an additional year before it is no longer supported at all.

With Craft 3 security support ending at the end of April 2024, now is a great time to review your current version. Craft 4 was released in May 2022 and will get full support until March 2025, then only security support until March 2026.

Please get in touch to talk through your site and how we can help keep you updated and secure.


Further reading