P粉6708387352023-08-23 22:07:58
If you are using PHP version 8, some plugins that are not yet supported may cause installation errors.
composer install --ignore-platform-req=php
or composer install --ignore-platform-reqs
This option can be used to set specific requirements that composer can ignore.
P粉2897750432023-08-23 09:22:20
In addition to the versions of other packages they require, Composer packages can also specify the PHP versions they support.
When parsing the version of a package to install, Composer must find a version that matches all constraints:
composer.json
If there is no package that satisfies all these constraints, you will receive an error.
Please note that version constraints for PHP versions follow the same rules as other Composer constraints . Therefore, the constraint ^7.0
means "any 7.x version above 7.0", excluding 8.0.
To solve this problem, you need to relax one of the constraints:
acme/some-package
in the example) and install it in Packagist (or any custom package source you configured) Find it on . composer.json
and other dependent packages do not exclude that new version. For example, if you currently depend on version ^1.0
of acme/some-package
, but PHP 8.0 is only supported starting with version 2.2.0, you will need to change the constraint to ^2.2
and make sure your application is still compatible. Sometimes you are pretty sure that your application will run correctly using the same package version as before. In this case, you can use platformconfiguration variables
in
composer.json to pretend you are still using the old version. This should only be used as a temporary workaround or for testing , as it means that packages may be installed that will not work at all on your new PHP version.
For example:
{ "config": { "platform": { "php": "7.4.999" } } }
See also "Overriding PHP base dependencies in Composer"