Composer does not recognize PHP 7

I created a travis profile to test my project from PHP 5.6 to PHP 7.

When starting the composer, the following error occurs:

Your requirements could not be resolved to an installable set of packages. Problem 1 - This package requires php ~5.4 but your PHP version (7.0.1-dev) does not satisfy that requirement. 

the command that I run:

 composer update -n 

with installing travis in PHP 5.6 I do not encounter this problem

+7
source share
4 answers

The package that you use, or your own software, explicitly requires PHP version 5.x ( ~5.4 ), where x is at least 4 or more (i.e. it will work with PHP 5.5, 5.6, or even 5.10 if it existed).

This package does not allow you to use PHP 7. Therefore, you cannot successfully run composer update .

+4
source

If the platform requirement is in your root package, you can solve it by introducing composer.json as such

 { "require": { "php": "~5.4 | ^7.0" } } 

You can also try to ignore platform requirements, but it depends on whether you want to see this:

 $ composer install --ignore-platform-reqs 

For reference, see https://getcomposer.org/doc/03-cli.md#install .

+16
source

check the composer.json file, delete this code:

  "config": { "bin-dir": "bin", "platform": { "php": "5.x.1" // Or change 5.x.1 to your php version } }, 
+4
source

change php default v

 sudo update-alternatives --config php 
0
source

All Articles