PHP development version problem handling

Time:2022-5-11

When installing an open source project, the author used PHP 7.1 locally for development, while my local is PHP 7.0, so a tragedy occurred. Such an error occurred:requires php ^7.1 -> your PHP version (7.0.13) does not satisfy that requirement..

1、 Composer installation package

Error after composer install

[email protected]:~/Code/sample$ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for doctrine/instantiator 1.1.0 -> satisfiable by doctrine/instantiator[1.1.0].
    - doctrine/instantiator 1.1.0 requires php ^7.1 -> your PHP version (7.0.13) does not satisfy that requirement.
  Problem 2
    - doctrine/instantiator 1.1.0 requires php ^7.1 -> your PHP version (7.0.13) does not satisfy that requirement.
    - phpunit/phpunit-mock-objects 2.3.8 requires doctrine/instantiator ^1.0.2 -> satisfiable by doctrine/instantiator[1.1.0].
    - Installation request for phpunit/phpunit-mock-objects 2.3.8 -> satisfiable by phpunit/phpunit-mock-objects[2.3.8].

2、 Solution

deletecomposer.lockFile, re executecomposer installSo that it can be regeneratedcomposer.lockThe file is.

After the composer package is loaded automatically, acomposer.lockLock the file, so after pulling someone else’s code from GitHub, you need to delete this file.