Search code examples
phpcakephpcomposer-php

CakePHP 3 to PHP 8.1 - Composer errors?


My CakePHP 3 project needs to be updated to support PHP 8.1, but i can't get the composer update to work.

Whenever i do, i get these errors:

  Problem 1
- cakephp/cakephp[3.9.0, ..., 3.9.3] require laminas/laminas-diactoros ^1.4.0 -> satisfiable by laminas/laminas-diactoros[1.4.0, ..., 1.8.7p2].
- cakephp/cakephp[3.8.0, ..., 3.8.13] require zendframework/zend-diactoros ^1.4.0 -> satisfiable by laminas/laminas-diactoros[1.4.0, ..., 1.8.7p2], zendframework/zend-diactoros[1.4.0, ..., 1.8.7].
- zendframework/zend-diactoros[1.4.0, ..., 1.4.1] require php ^5.4 || ^7.0 -> your php version (8.1.10) does not satisfy that requirement.
- laminas/laminas-diactoros[1.4.0, ..., 1.4.1] require php ^5.4 || ^7.0 -> your php version (8.1.10) does not satisfy that requirement.
- zendframework/zend-diactoros[1.5.0, ..., 1.8.7] require php ^5.6 || ^7.0 -> your php version (8.1.10) does not satisfy that requirement.
- laminas/laminas-diactoros[1.5.0, ..., 1.8.7p2] require php ^5.6 || ^7.0 -> your php version (8.1.10) does not satisfy that requirement.
- cakephp/cakephp[3.9.4, ..., 3.10.5] require php >=5.6.0,<8.0.0 -> your php version (8.1.10) does not satisfy that requirement.
- Root composer.json requires cakephp/cakephp ~3.8 -> satisfiable by cakephp/cakephp[3.8.0, ..., 3.10.5].

Here is my composer file:

{
"name": "cakephp/app",
"description": "CakePHP skeleton app",
"homepage": "http://cakephp.org",
"type": "project",
"license": "MIT",
"require": {
    "php": ">=8.0",
    "cakephp/cakephp": "~3.8",
    "mobiledetect/mobiledetectlib": "2.*",
    "cakephp/migrations": "~1.0",
    "cakephp/plugin-installer": "*"
},
"require-dev": {
    "psy/psysh": "@stable",
    "cakephp/debug_kit": "~3.2",
    "cakephp/bake": "~1.1"
},
"suggest": {
    "phpunit/phpunit": "Allows automated tests to be run without system-wide install.",
    "cakephp/cakephp-codesniffer": "Allows to check the code against the coding standards used in CakePHP."
},
"autoload": {
    "psr-4": {
        "App\\": "src"
    }
},
"autoload-dev": {
    "psr-4": {
        "App\\Test\\": "tests",
        "Cake\\Test\\": "./vendor/cakephp/cakephp/tests"
    }
},
"scripts": {
    "post-install-cmd": "App\\Console\\Installer::postInstall",
    "post-create-project-cmd": "App\\Console\\Installer::postInstall",
    "post-autoload-dump": "Cake\\Composer\\Installer\\PluginInstaller::postAutoloadDump"
},
"minimum-stability": "stable",
"prefer-stable": true,
"config": {
    "allow-plugins": {
        "cakephp/plugin-installer": true
    }
}

}

I can do a composer install command without issues.. i have also tried to do composer update --with-all-dependencies but same issue.

Anyone with any ideas on what i can do to resolve it? thanks a lot :)


Solution

  • CakePHP 3 does not support PHP 8.

    Version map

    CakePHP core branch PHP min PHP max
    2.x EOL 2.x PHP 5.4 PHP 7.4
    3.x EOL 3.x PHP 5.6 PHP 7.4
    4.x 4.x / 4.next PHP 7.2 Latest
    5.0 (upcoming) 5.x PHP 8.1 Latest

    Note: PHP 8+ compatibility with CakePHP 4.2+.

    https://github.com/cakephp/cakephp/wiki