CakePHP Tips Autumn 2025

Healthchecks / Uptime

With increasing complexity of apps and more and more requirements on your server and tooling, it can be easily overlooked, when doing updates or migrating servers.
I highly recommend a way to track your requirements.

Some are easier verified, e.g. extensions, as composer would already complain on "install".
Others like memcache or third party tools could be overlooked until maybe someone notices eventually.

My recommendation:
Use Setup plugin and its healthchecks to run on changes to your server, but also in general periodically to see if all is still up and well.

Often enough somehow the postmaxsize or uploadmaxsize got reset or forgotten for either CLI or web, and suddenly the uploads didn’t work anymore for users (default often is ridiculous 2MB). Or someone forget the composer install on the server, and the version in the composer file did not match (yet) the lock file.
All of those things can be checked as well, and most of those ship out of the box here as convenient checks.

Web CLI
Healthcheck Healthcheck CLI

You can define your own custom checks on top, or adjust/replace the default ones.

See docs for details.

Audit log your tables

If you ever accidentally deleted some data, or even modified it and you wanted to look what the old value was: It is usually gone.
There is an easy Cake solution to it: Audit logs.

Imagine it just silently tracks all the changes for a specific table, or even all your relevant tables.
And if you wanted to restore a deleted record, or parts of it, it would be right there only 1 click away.

Storage here is usually cheap and especially if those records are important to track any change on, this comes quite easy and fast.
It can be useful to go back in time and find out who changed what at what time, and maybe ask that person about details on this.

I personally like to log-rotate the ones that are not business critical. They would just be around for months or weeks maybe, depending on the record modifications per table.

Checkout the AuditStash plugin for details. It also links the live sandbox demo you can play around with.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.