Composer setting ignores version-matching methods _php instances

Source: Internet
Author: User

Composer Introduction

Composer is a dependency management tool for PHP. It allows you to affirm the code base on which the project depends, and it will install 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 does not install anything on the global. So, this is just a dependency management.

The execution composer install encountered an error: Your requirements could is resolved to a installable set of packages. This is because it does not match the version requested by Composer.json.

The complete error is as follows:

 vagrant@homestead:/usr/share/nginx/html/laravel-blog$ sudo composer install Composer repositories with package information installing dependencies (including Require-dev) from lock file Your require
Ments could is resolved to a installable set of packages.
Problem 1-installation Request for Doctrine/instantiator 1.0.3-> satisfiable by doctrine/instantiator[1.0.3].
-Doctrine/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
. -Phpunit/phpunit-mock-objects 2.3.0 requires Doctrine/instantiator ~1.0,>=1.0.1-> by satisfiable
instantiator[1.0.3]. -Installation request for phpunit/phpunit-mock-objects 2.3.0-> satisfiable by phpunit/phpunit-mock-objects[2.3.0]. 

Prompt my PHP 7 version is too high, does not conform to the Composer.json need version, but should also be able to run under the PHP 7, composer may set ignores the version match, the command is:

Composer Install--ignore-platform-reqs

Or

Composer Update--ignore-platform-reqs

Execute the composer command again to install the package normally.

If you are prompted to warn:

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

This is the implementation of composer in the virtual machine, indicating that this directory does not have writable permissions, composer can not cache downloaded packets, so that each time you have to download, the directory can be written to read can be changed.

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

In addition, in the virtual machine also set composer for the domestic mirror, or download the slow death, implementation:

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

OK, that's it.

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.