Install composer error for php 8.0.1

Hi, I’m trying to install yii2 advanced or basic just for test a couple of thing but i get always this error

composer create-project --prefer-dist yiisoft/yii2-app-basic basic
Creating a "yiisoft/yii2-app-basic" project at "./basic"
Info from #StandWithUkraine
Installing yiisoft/yii2-app-basic (2.0.46)
  - Installing yiisoft/yii2-app-basic (2.0.46): Extracting archive
Created project in D:\xampp\htdocs\dashboard\ITACA V2\basic
Loading composer repositories with package information
Info from #StandWithUkraine
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - codeception/module-yii2[1.1.0, ..., 1.1.1] require php >=5.6.0 <8.0 -> your php version (8.0.1) does not satisfy that requirement.
    - codeception/codeception[4.0.0, ..., 4.1.8] require php >=5.6.0 <8.0 -> your php version (8.0.1) does not satisfy that requirement.
    - symfony/browser-kit[v6.0.0, ..., v6.0.11] require php >=8.0.2 -> your php version (8.0.1) does not satisfy that requirement.
    - symfony/browser-kit[v6.1.0, ..., v6.1.3] require php >=8.1 -> your php version (8.0.1) does not satisfy that requirement.
    - codeception/module-yii2[1.1.2, ..., 1.1.5] require codeception/codeception ^4.0 -> satisfiable by codeception/codeception[4.0.0, ..., 4.2.2].
    - codeception/module-yii2[1.1.6, ..., 1.1.7] require codeception/lib-innerbrowser ^3.0 -> satisfiable by codeception/lib-innerbrowser[3.0.0, ..., 3.1.2].
    - codeception/codeception[4.1.9, ..., 4.2.2] conflict with codeception/module-filesystem 3.0.0.
    - codeception/lib-innerbrowser[3.0.1, ..., 3.1.2] require symfony/browser-kit ^4.4.24 || ^5.4 || ^6.0 -> satisfiable by symfony/browser-kit[v6.0.0, ..., v6.1.3].
    - codeception/lib-innerbrowser 3.0.0 requires symfony/browser-kit ^4.4 || ^5.4 || ^6.0 -> satisfiable by symfony/browser-kit[v6.0.0, ..., v6.1.3].
    - Root composer.json requires codeception/module-filesystem ^3.0 || ^1.1 -> satisfiable by codeception/module-filesystem[3.0.0].
    - Root composer.json requires codeception/module-yii2 ^1.1 -> satisfiable by codeception/module-yii2[1.1.0, ..., 1.1.7].

There is a way to solve it or i need to move on a server with php 8.0 or lesser? That could be a little problematic

Thanks and sorry, my English is not so good

I just tried the composer installation.
No problem (php 8.1.4)

it gives me error. I also put the error in first comment.

  • codeception/module-yii2[1.1.0, …, 1.1.1] require php >=5.6.0 <8.0 → your php version (8.0.1) does not satisfy that requirement…

So at least it will work with php 8.1.4.

Nice to know :joy: it doesn’t help much though I’ll see if I can update to 8.1.4

If you are sure of what you are doing you can ignore platform requirements with:
composer --ignore-platform-reqs create-project --prefer-dist yiisoft/yii2-app-basic basic

Why do you start a new thread instead of searching the forum first? This thread seems to be a complete duplicate of my own post. This issue was already discussed by @evstevemd and many others in April.

@IlMurlocDiplomato This is not a bug in yii or composer, but simple version mismatch. Current version of PHP (8.0.1 in your case, 8.2.4 in my case) is way newer than the one expected in composer.json file (8.0.0 or less).

You have got three options here:

  • Use --ignore-platform-reqs as @evstevemd greatly suggests
  • Downgrade your PHP version to 8.0.0 (very not good idea)
  • Fork yiisoft/yii2-app-basic repository in GitHub and modify composer.json file to match your PHP version. Then try to use composer create-project on your own repository instead.

@tri No, this is not possible. If you have this line exactly as at source (i.e. require php >=5.6.0 <8.0) then this is impossible that your composer update completes without errors on PHP 8.1.4. You either commented out or modified this line to match 8.1.4 or your composer installation is reading some other PHP version number.

@MircoCagni No, updating to 8.1.4 won’t solve you the problem. You will be still facing this error unless use use --ignore-platform-reqs flag on composer update or composer create-project.

In general, if you are starting a brand new Yii 2 project from scratch (and this is what using composer create-project by OP suggests) you should do this on the newest publicly available PHP version. I wouldn’t start today a new project neither on 8.0.1 or 8.1.4. I would use 8.2.4, because this is the newest version available in XAMPP which I use. And I am to lazy to compile my own version of PHP! :slight_smile: