Composer setting ignores version matching methods, composer matching _php tutorial

Source: Internet
Author: User
Tags composer install

Composer setting ignores version matching methods, composer matches


Composer Introduction

Composer is a dependency management tool for PHP. It allows you to declare the code base on which the project depends, and it installs them for you in your project. Composer is not a package manager. Yes, it involves "packages" and "libraries", but it is managed on a per-project basis and installed in a directory of your project (for example, vendor). By default it will not install anything globally. Therefore, this is only a dependency management.

Execute composer install encountered error: Your requirements could not being resolved to an installable set of packages. This is because the version requested by the Composer.json is not matched.

The complete error is as follows:

vagrant@homestead:/usr/share/nginx/html/laravel-blog$ sudo composer installloading composer repositories with package informationinstalling dependencies (including Require-dev) from lock fileyour requirements could not being resolved to an INS Tallable set of packages. Problem 1-installation Request for Doctrine/instantiator 1.0.3, satisfiable by doctrine/instantiator[1.0.3].-doctr Ine/instantiator 1.0.3 requires PHP ~5.3-your PHP version (7.0.3) does not satisfy that requirement. Problem 2-doctrine/instantiator 1.0.3 requires PHP ~5.3-your PHP version (7.0.3) does not satisfy that requirement. -Phpunit/phpunit-mock-objects 2.3.0 requires Doctrine/instantiator ~1.0,>=1.0.1-satisfiable by doctrine/ instantiator[1.0.3].-installation request for Phpunit/phpunit-mock-objects 2.3.0, satisfiable by phpunit/ PHPUNIT-MOCK-OBJECTS[2.3.0].

Tip My PHP 7 version is too high, does not conform to Composer.json required version, but in PHP 7 should also be able to run, composer can be set to ignore version matching, the command is:

Composer Install--ignore-platform-reqs

Or

Composer Update--ignore-platform-reqs

Execute the composer command again to install the package properly.

If prompted for warning:

Cannot create cache Directory/home/vagrant/.composer/cache/repo/https---packagist.org/, or directory is not writable.  Proceeding without cachecannot create cache directory/home/vagrant/.composer/cache/files/, or directory is not writable. Proceeding without cache

This is the execution of composer in the virtual machine, that the directory does not have writable permissions, composer cannot cache the downloaded package, so that each time you have to re-download, the directory is changed to writable readable.

sudo chmod-r 777/home/vagrant/.composer/cache/files/

In addition, in the virtual machine also set composer for the domestic mirror, or download slow to die, execute:

Composer Config-g Repo.packagist composer https://packagist.phpcomposer.com

OK, you are done.

http://www.bkjia.com/PHPjc/1123827.html www.bkjia.com true http://www.bkjia.com/PHPjc/1123827.html techarticle Composer setting ignores version matching methods, Composer matching Composer introduction Composer is a dependency management tool for PHP. It allows you to affirm the code base that the project relies on, and it will be in your ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.