Best of CakePHP – November 2020

I spend a lot of time thinking and reading about the CakePHP framework, so I come across lots of interesting articles. I’ve decided to put together a list of all my favorite articles from the month of November on CakePHP. You can also find my list of best CakeFest talks here. Hope you enjoy it!

PHP 8.0

I mentioned PHP 8.0 in my post on upcoming trends in CakePHP, and I believe it warrants another mention here. The CakeDC blog, CakePHP’s official blog, even wrote an article about some of the upcoming features. If you want to stay on the cutting edge of CakePHP, or PHP in general, you should experiment with PHP 8.0 now!

CakePHP 5 Anouncement

CakePHP 5’s current plan is to require PHP 8.0. This will offer all the new features of PHP 8 alongside a speed boost! If you’re interested in contributing ideas to the newest version of CakePHP you can fill out the official questionnaire here.

Dereuromark, a contributor to CakePHP, also created a tool to upgrade the composer of your CakePHP application. Dereuromark also shows up on our list of top posts!

Upgrade to PHP 7.4 now | DerEuroMark

Dereuromark makes an excellent argument for upgrading your CakePHP application to PHP 7.4. Especially if you’re coming from the CakePHP 2 or 3 world, as PHP 7.4 will be more strict about throwing otherwise potentially silent errors.

Did you know that PHP didn’t throw errors for division by zero? That’s not really relevant, but I learned that today.

While we’re upgrading our code let’s take a look at Traits to help us stay DRY-compliant!

Baking With Traits | CakeDC

In this post, you can learn the basics of working with Traits. It shows you how you can use Traits to separate your code by responsibility, where to initialize the Traits you’ll use, and gives you some further reading if you want to take a deep dive into Traits!

CakePHP is evolving all the time, let’s take a look at the new releases and highlight the top 3 features from each.


There were 4 new CakePHP versions released this month. Click on the version number titles for the full rundown of added features, otherwise you can check out the highlights I’ve written for each!


  • Http\\Client::createFromUrl() was added.
  • Http\\FlashMessage was added. This utility class enables flash messages to be manipulated from within middleware.
  • Http\\ServerRequest::getFlash() was added to expose the new flash utility.


  • Warnings emitted by AuthComponent when using strict mode and a mocked request were fixed.
  • Mailer::setReplyTo() now accepts multiple email addresses. This change aligns Reply-To with other email fields that accept multiple recipients.
  • Improved API documentation.


  • Experimental support for a [Dependency Injection](<>) container was added.
  • ORM\\Behavior::getTable() has been deprecated. Use table() instead. This change makes method names dissimilar between ORM\\Table as the return value of these methods is different.
  • A new utility class Cake\\Http\\FlashMessage was added whose instance is available through ServerRequest::getFlash(). The class similar to the FlashComponent allows you to set flash messages. It can be particularly useful for setting flash messages from middlewares.


  • Fixed warning about SameSite index when upgrading from earlier versions of 3.x.
  • Added upper PHP version constraint of <8.0. Because 3.x has several dependencies that are not compatible with PHP 8, we also cannot easily support PHP 8 without breaking compatibility.
  • The pj() function now supports UTF-8 data better. 1.0 is a serverless platform for PHP. I brefly (sic./haha?) mentioned it in my upcoming trends in CakePHP. Those who run their applications in the cloud will find serverless to be the next logical step, as it promises to run applications at scale automatically, only charge when the code is run, and provide reliable architecture! If you’ve never deployed a serverless application before I highly recommend you read through a tutorial over the weekend.

Last, but not least, is CakePHP’s swag!

CakePHP Swag

I don’t think this was technically released in November, but I found out about it in November, so I thought I’d share. Neat looking swag, eh?

p.s. Did you see the restaurant serving CakePHP?

Did I miss your favorite article, do you like these types of posts? Let me know in the comments below! Subscribe if you want new articles on CakePHP every Tuesday and Thursday.