Dependencies 如何覆盖托管在packagist.org上的composer.json定义的所需版本?

Dependencies 如何覆盖托管在packagist.org上的composer.json定义的所需版本?,dependencies,requirements,composer-php,Dependencies,Requirements,Composer Php,我有以下composer.json文件: { "require": { "guzzlehttp/guzzle": "^5.3" }, "require-dev": { "aeris/guzzle-http-mock": ">=1.1.5" } } 我想强制使用不同版本的(例如5.3.1),但是,要求似乎是从packagist.org上托管的composer.json文件中读取的。是否有替代这些要求的解决方法 因此,不是: "guzzlehttp/guzzl

我有以下
composer.json
文件:

{
  "require": {
    "guzzlehttp/guzzle": "^5.3"
  },
  "require-dev": {
    "aeris/guzzle-http-mock": ">=1.1.5"
  }
}
我想强制使用不同版本的(例如
5.3.1
),但是,要求似乎是从packagist.org上托管的
composer.json
文件中读取的。是否有替代这些要求的解决方法

因此,不是:

"guzzlehttp/guzzle": "~5.0.0"
我想设定:

"guzzlehttp/guzzle": "^5.3"
理想情况下,只更改我的本地
composer.json
文件

当前,该命令显示冲突错误:

$ composer install --prefer-source -vvv
Reading ./composer.json
Loading config file ./composer.json
...
Reading ~/.composer/cache/repo/https---packagist.org/provider-aeris$guzzle-http-mock.json from cache
Resolving dependencies through SAT
Dependency resolution completed in 0.000 seconds
Reading ~/.composer/cache/repo/https---packagist.org/provider-guzzlehttp$guzzle.json from cache
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for aeris/guzzle-http-mock >=1.1.5 -> satisfiable by aeris/guzzle-http-mock[1.1.5].
    - aeris/guzzle-http-mock 1.1.5 requires guzzlehttp/guzzle ~5.0.0 -> satisfiable by guzzlehttp/guzzle[5.0.0, 5.0.1, 5.0.2, 5.0.3] but these conflict with your requirements or minimum-stability.

有一个解决方法是使用它来替换给定的包,所以其他包不会下载它。例如:

{
  "require": {
    "aeris/guzzle-http-mock": ">=1.1.5"
  },
  "replace": {
    "guzzlehttp/guzzle": "~5.0.0"
  },
  "minimum-stability": "dev",
  "prefer-stable": true
}
将忽略guzzle http/guzzle依赖项,并且不会下载,但是需要单独提供正确的版本或作为包的一部分提供

例如,可以通过添加以下内容手动克隆所需的存储库:

"repositories": [
  {
    "type": "vcs",
    "url": "https://github.com/guzzle/guzzle.git"
  }
]

另一个想法是使用如下方法:

但是,通过这种方法测试后,它并没有像预期的那样工作,但也许有一种方法


相关GitHub线程:

"guzzlehttp/guzzle": "dev-5.3.0 as 5.0.3"