Getting Ready for Craft CMS 4

A collection of articles on what you need to do to prepare for Craft CMS 4.

Image

Craft CMS ver­sion 4 is due out in beta in Q1 2022 and then a final release some­time in Q2. There will be plen­ty of time to get ready but you shouldn’t put it off until the last minute. 

Here is some help­ful infor­ma­tion on Craft CMS4 and how you can prepare:

What are the new fea­tures in Craft 4? #

Pix­el & Ton­ic announced Craft 4 fea­tures dur­ing Dot All 2021. Planned right now are sup­port for col­lec­tions, mul­ti-fac­tor auth, inac­tive user accounts, con­di­tion­al fields, and more.

Read: What are the new fea­tures in Craft CMS 4?

When will Craft 4 be released? #

In the State of Craft talk at the 2021 Dot All con­fer­ence, Pix­el & Ton­ic CEO Bran­don Kel­ly announced that Craft 4 will be avail­able in beta start­ing in the first quar­ter of 2022, with a final release the quar­ter after.

Read: When will Craft CMS 4 be released?

Fix Your Dep­re­ca­tion Errors #

Back in 2018, when Craft 3.0 was released, the Craft CMS offi­cial­ly dep­re­cat­ed some Craft 2 and pri­or con­fig­u­ra­tion set­tings, PHP con­stants, tem­plate tags, tem­plate func­tions, query para­me­ters, query meth­ods, ele­ment prop­er­ties, mod­el meth­ods, and locales methods.

So, a lot of stuff. 

But some of those dep­re­cat­ed items might still be lurk­ing in ours projects. Maybe we’ve avoid­ed look­ing that Dep­re­ca­tion Warn­ings sec­tions of Util­i­ties in the Craft con­trol pan­el. Or new dep­re­ca­tion warn­ings popped up because some old code wasn’t called frequently.

Read: Fix Your Dep­re­ca­tion Errors

Dep­re­cat­ed in Craft 3, Removed in Craft 4
ItemDescrip­tionDocs
Con­fig settingsEight con­fig set­tings are going away in Craft.Learn more
PHP Con­stantsFor plu­g­in devel­op­ers, two Craft PHP con­stants have changed.Learn more
Tem­plate TagsSome tem­plate tags relat­ed to includ­ing assets will be removed or changed.Learn more
Tem­plate FunctionsSev­er­al tem­plate func­tions are going away com­plete­ly, while oth­ers will have replace­ments. Too many to list!Learn more
Ele­ment QueriesThis is where you’ll like­ly have the major­i­ty of your dep­re­ca­tion warn­ings through­out your Twig tem­plates. The big one is treat­ing queries as arrays. Use .all() for all ele­ment queries now.Learn more
Ele­mentsOne change with the tag ele­ment and the removal of the locale prop­er­ties from all ele­ments (because of mul­ti-site in Craft 3)Learn more

Note: This does not cov­er changes to plu­g­in devel­op­ment in Craft 4.

Stay Updat­ed #

For any projects you plan to update to Craft 4, you should plan to have them on the lat­est Craft 3 before the update. The goal is to make the upgrade gulf between ver­sion 3 and 4 as small as possible. 

Craft 3 releas­es will end at 3.7.x (i.e. no Craft 3.8) and after Craft 4 will only be secu­ri­ty updates. If you have a project that isn’t yet on Craft 3.7, now is the oppor­tune time to update it.

PHP 8 Sup­port #

In Feb­ru­ary 2022, Pix­el & Ton­ic bumped up the min­i­mum PHP require­ment to PHP 8.0.2. Before you plan to update a project to Craft 4, check that your cur­rent pro­duc­tion host­ing envi­ron­ment sup­ports PHP 8.0.2.

Check Project Plu­g­in Depen­den­cies #

Every plu­g­in you use in your projects will need an update to it to make it com­pat­i­ble with Craft 4. Your abil­i­ty to update a project to Craft 4 will depend on a required plugin’s sup­port of Craft 4

I rec­om­mend you or your team make a kan­ban board (or what­ev­er you use to track project work) just for the update to Craft 4. Cre­ate a card for each item required to update to Craft 4: one card for each plu­g­in you use, one for your host­ing environment’s sup­port of PHP 8.0.2, etc.

There will be a beta peri­od for Craft 4, last at least a cou­ple of months, that will give all plu­g­in devel­op­ers time to update their plu­g­ins. How­ev­er, some plu­g­in authors will choose not to update their plu­g­ins. You’ll want to plan for alter­na­tives, if that’s the case.