Is there a way to use Sage 9 with PHP 8.1?

Hello guys,
I have to upgrade Php version from 7.4 to 8.1 on my project.
Unfortunately Sage 9 doesn’t seem to be compatible with php 8.1.
Some dependencies blocked the migration : illuminate/support for example.

Some of you did find a way to migrate your php version ?

Thanks a lot for your help !

Hi @Clementine_FERNANDEZ,

I upgraded a Sage 9-project just recently to work with PHP 8.1 so I can gladly share what worked for me:

Essentially you’d have to replace the sage-installer and sage-lib packages in the theme’s composer.json to use the forked variants that have been updated to work with PHP 8.x.

This is my composer-file:

  "name": "roots/sage",
  "type": "wordpress-theme",
  "license": "MIT",
  "description": "WordPress starter theme with a modern development workflow",
  "homepage": "",
  "authors": [
      "name": "Ben Word",
      "email": "",
      "homepage": ""
      "name": "Scott Walkinshaw",
      "email": "",
      "homepage": ""
      "name": "QWp6t",
      "email": "",
      "homepage": ""
  "keywords": ["wordpress"],
  "support": {
    "issues": "",
    "forum": ""
  "autoload": {
    "psr-4": {
      "App\\": "app/"
  "repositories": [
    { "type": "vcs", "url": "" },
    { "type": "vcs", "url": "" }
  "require": {
    "php": "^7.4|^8.0",
    "composer/installers": "^2.0",
    "soberwp/controller": "~2.1.0",
    "roots/sage-installer": "^2.0",
    "roots/sage-lib": "dev-master",
    "log1x/blade-svg-sage": "dev-chore/illuminate-8.x"
  "require-dev": {
    "squizlabs/php_codesniffer": "^2.8.0",
    "filp/whoops": "^2.12"
  "scripts": {
    "test": ["phpcs"],
    "post-create-project-cmd": [

Note that I reorder the packages slightly and referenced the log1x/blade-svg-sage which is optional but also needs an update to be compatible, thus listing this as well.

If I remember correctly the illuminate/support-package is listed as a dependency with another package so it can be safely omitted here.

Compare to Sage 9’s default composer.json.

Let me know if that works out for you!


Thanks a lot for your help @evance .
This solution doesn’t work for me, I still have issues when I run composer update :

Problem 1
    - Root composer.json requires roots/sage-installer ^2.0, found roots/sage-installer[dev-master, dev-tailwind-2-support, dev-bulma-scss-fix, dev-bootstrap-4.3.0, dev-bootstrap-4.3.1, 1.0.0, ..., 1.6.4] but it does not match the constraint.

Problem 2
    - Root composer.json requires roots/sage-lib dev-master -> satisfiable by roots/sage-lib[dev-master].
    - roots/sage-lib dev-master requires composer/installers ~1.0 -> found composer/installers[v1.0.0, ..., v1.12.0] but it conflicts with your root composer.json require (^2.0).
1 Like

Yes, because you didn’t change / add the necessary repositories – please review the complete composer.json I’ve posted and compare it to the Sage 9 default in order to spot all the changes.

Okay it’s clear now, thanks a lot !

1 Like

I used @evance’s composer example to update Sage 9 on php 8.1 but I encountered illuminate/filesystem/Filesystem errors.

Removing blade-svg-sage and installing illuminate/support resolved the issue for me.

% composer remove log1x/blade-svg-sage  
% composer require  illuminate/support
1 Like