Looks like the dependency to symfony’s packages cause some issues when trying to support PHP <= 5.6, right after updating dependencies composer update, you’ll get the polyfill-php80 error, this seems to be related to some symfony’s underlying packages which require php 7.x (I believe doctrine…), the `“php”:">=5.6.0" in the composer.json has no effect, yii2 should works well with 5.6 right? is there any way to downgrade symfony/doctrine without breaking the project ?
Related old issue:
I’ve just found this question, and I wonder if this can’t be fixed and Yii2 is still depending on symfony’s packages, why we’re keeping Yii2 on PHP 5.6?
I’m not sure what you mean, I believe some of the underlying libraries aren’t compatible with 5.6, it doesn’t have that constraint but it does allow any underlying package to require anything (without any constraints), is this issue related to composer ?
Adding some extra constraints to composer.json of your project.
Using --no-dev switch in composer.
The 1st one is recommended. But if you do have to keep using PHP 5.6, then I think you will have to add some lines to your composer.json that explicitly require the older versions of dependencies(2), or exclude all the dependencies required for development(3) assuming that all the dependency error occurs in require-dev sections.
This seems to be the price you have to pay when you want to continue using older versions of PHP.
I have no idea what really are causing composer error in your case, but I’m sure yii2-app-basic runs fine with PHP 5.6, because every build is automatically tested against PHP 5.6, 7.0, 7.1, 7.2, 7.3 and 7.4.
Checking your dependency with composer show --tree will help you examine the composer error.
Thanks! I have to confess, the error was on my side, my server has a different versions of php for command line, so I had use the exact version of php to run composer or add the following in config section of composer.json:
This force composer to emulate a production env or define your target platform as stated in the doc.