PHP 8.5 and Statamic
PHP 8.5 came out in November, and since last week's 5.71 release, Statamic 5 officially supports it. Before you update PHP on a site, it's worth knowing which Laravel versions it works with and what 8.5 changes in your own code.
· 3 min read · Thomas Sausen
What Statamic 5.71 changed
Statamic 5.71, released on January 8, lists PHP 8.5 compatibility as its first new feature. Duncan McClean's pull request is small. Most of it raises version constraints and adds PHP 8.5 to the test matrix. It was merged in early December and shipped with the first 5.x release of the new year.
The one real code change shows what PHP 8.5 is strict about. When Statamic looked up collections mounted on a page, collections without a mount ended up under null as an array key. PHP 8.5 deprecates using null as an array offset, so the lookup now uses a placeholder key and filters those collections out.
The test matrix tells you something else. Statamic 5 only tests PHP 8.5 with Laravel 12, so for PHP 8.5 you need Laravel 12.40 or later. A Statamic 5 site on Laravel 10 or 11 has to move to Laravel 12 first. Statamic 6, which is close to release, already runs its tests on PHP 8.3, 8.4, and 8.5.
What PHP 8.5 changes in your own code
Statamic handles its own upgrade, but custom code on a site doesn't update itself. The release announcement lists a few deprecations worth checking before you switch: using null as an array offset, the backtick operator as a shortcut for shell_exec(), and old cast names like (boolean) and (integer). Deprecations don't break a site, but they fill the logs, and they're likely to become errors in PHP 9. The null offset is the one most likely to show up in addons and custom tags, as Statamic's own fix shows.
The new features matter mainly where you write your own PHP, in custom tags, modifiers, or controllers. The pipe operator |> chains functions from left to right instead of nesting them. The new functions array_first() and array_last() replace the usual workarounds with reset() or array_key_last(). Cloning gets an update too, since clone() can now change properties while copying, which makes readonly value objects easier to write. Fatal errors such as timeouts now include a backtrace, which helps when a slow request dies in production.
Should you update now?
For sites moving to Statamic 6 soon, PHP 8.5 is a reasonable choice from the start, since the new version is already tested against it. There's little reason to set up a new server with an older version.
For Statamic 5 sites, it depends on the Laravel version. On Laravel 12, update Statamic to 5.71 or later, check your addons and custom code for the deprecations above, and the switch should be straightforward. On Laravel 10 or 11, PHP 8.5 isn't tested, and moving the framework first makes more sense anyway. Laravel 10 is already out of security support, and Laravel 11 follows in March.
There's also no hurry. PHP 8.4 gets active support until the end of 2026 and security fixes until the end of 2028. If a site runs fine on 8.4, you can wait to move to 8.5 until the next maintenance window.
Sources
- PHP 8.5 Compatibility (opens in new tab), statamic/cms on GitHub, December 4, 2025
- Release Notes (opens in new tab), Statamic
- PHP 8.5 Release Announcement (opens in new tab), PHP, November 20, 2025
- Supported Versions (opens in new tab), PHP
Thomas Sausen is a freelance web developer and the editor of Flatbard. He builds with Statamic and writes about the surrounding ecosystem.