Current version of Yii 2 not ready for PHP 8.2.x

As confirmed in here, if your to create a brand new Yii 2 project, i.e.:

composer create-project --prefer-dist yiisoft/yii2-app-basic basic

you’ll face following error (short version):

Your requirements could not be resolved to an installable set of packages.

This is normal and you must execute some more commands as a workaround.

The full error code is:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires codeception/module-filesystem ^2.0 || ^1.1 -> satisfiable by codeception/module-filesystem[2.0.0, 2.0.1, 2.0.2].
    - Conclusion: don't install codeception/codeception 5.0.5 (conflict analysis result)
    - Conclusion: don't install codeception/codeception 5.0.6 (conflict analysis result)
    - Conclusion: don't install codeception/codeception 5.0.7 (conflict analysis result)
    - codeception/module-yii2 1.1.8 requires codeception/codeception ^5.0.8 -> satisfiable by codeception/codeception[5.0.8, 5.0.9, 5.0.10].
    - Conclusion: don't install codeception/codeception 5.0.8 (conflict analysis result)
    - Conclusion: don't install codeception/codeception 5.0.10 (conflict analysis result)
    - codeception/module-yii2[1.1.0, ..., 1.1.1] require php >=5.6.0 <8.0 -> your php version (8.2.0) does not satisfy that requirement.
    - codeception/module-yii2[1.1.2, ..., 1.1.3] require php >=5.6.0 <8.1 -> your php version (8.2.0) does not satisfy that requirement.
    - codeception/module-yii2 1.1.4 requires php >=5.6.0 <=8.1 -> your php version (8.2.0) does not satisfy that requirement.
    - codeception/module-yii2 1.1.5 requires php >=5.6.0 <=8.1 | ~8.1.0 -> your php version (8.2.0) does not satisfy that requirement.
    - codeception/module-yii2 1.1.6 requires codeception/codeception ^5.0.0 -> satisfiable by codeception/codeception[5.0.0, ..., 5.0.10].
    - codeception/module-yii2 1.1.7 requires codeception/codeception ^5.0.0-RC6 -> satisfiable by codeception/codeception[5.0.0, ..., 5.0.10].
    - Conclusion: don't install codeception/codeception 5.0.0 (conflict analysis result)
    - Root composer.json requires codeception/module-yii2 ^1.1 -> satisfiable by codeception/module-yii2[1.1.0, ..., 1.1.8].

And it pretty much tells you that codeception‘s module has maximum PHP version declared as 8.1 while your environment already has version 8.2 (8.2.4 currently) on-board.

To work around this problem, simply execute the following sequence of commands:

composer create-project --prefer-dist yiisoft/yii2-app-basic basic
cd basic
composer update --ignore-platform-req=php

That should be all.

Leave a Reply