Although I support clients on a wide range of PHP versions (everything from 5.x to 8.x), I’m gradually moving my personal projects to track the latest stable version of PHP. As part of this work, I updated my Slim Skeleton project to use PHP 8.3.
Updating Composer configuration: This was easy – I just had to update the minimum PHP version in the require
block and the version used in the platform
block (which allows a different version to be targetted than the one on the host).
Updating Docker: This was easy to do, but I discovered that the 8.3 image didn’t include the intl extension, which in turn had a dependency on the libicu-dev
package in Debian. Xdebug also needed updating as I build that as part of the Docker process.
Bump Composer package versions: Most packages had new major versions, fortunately without any breaking changes so I could simply tweak the composer.json
file and run composer update
.
Doctrine attributes: The latest version of Doctrine removed support for annotations, forcing me to move to attributes. Fortunately attributes are much nicer to work with, and Visual Studio Code autocompletes them for me.
I also used this as an opportunity to switch to the PHP-DI Slim Bridge, move class members to constructor promotions, and autowire some of the dependencies, which reduced the amount of boilerplate code and made additional dependencies easier to add at a later date.
All in all, a relatively painless experience – though I expect to encounter further issues as I migrate projects which have been bootstrapped from Slim Skeleton and therefore have more code.