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": "https://roots.io/sage/",
"authors": [
{
"name": "Ben Word",
"email": "ben@benword.com",
"homepage": "https://github.com/retlehs"
},
{
"name": "Scott Walkinshaw",
"email": "scott.walkinshaw@gmail.com",
"homepage": "https://github.com/swalkinshaw"
},
{
"name": "QWp6t",
"email": "hi@qwp6t.me",
"homepage": "https://github.com/qwp6t"
}
],
"keywords": ["wordpress"],
"support": {
"issues": "https://github.com/roots/sage/issues",
"forum": "https://discourse.roots.io/"
},
"autoload": {
"psr-4": {
"App\\": "app/"
}
},
"repositories": [
{ "type": "vcs", "url": "https://github.com/jeh5256/sage-installer" },
{ "type": "vcs", "url": "https://github.com/jeh5256/sage-lib" }
],
"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": [
"Roots\\Sage\\Installer\\ComposerScript::postCreateProject"
]
}
}
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!