如何使用相互依赖的composer同时安装2个Symfony包

时间:2016-12-30 13:55:26

标签: symfony composer-php elastica foselasticabundle

我想将friendsofsymfony/elastica-bundle3.1.*升级到dev-master

您可以看到我当前的composer.json设置:

"require": {
    "php": ">=5.3.9",
    "symfony/symfony": "2.8.*",
    "doctrine/orm": "^2.4.8",
    "doctrine/doctrine-bundle": "~1.4",
    ...
     "friendsofsymfony/elastica-bundle": "3.1.*"
},

问题在于我删除行friendsofsymfony/elastica-bundle然后运行composer require fiendsofsymfony/elastica-bundle "dev-master"

Your requirements could not be resolved to an installable set of packages.

  Problem 1
- Installation request for friendsofsymfony/elastica-bundle dev-master -> satisfiable by friendsofsymfony/elastica-bundle[dev-master].
- friendsofsymfony/elastica-bundle dev-master requires ruflin/elastica 3.2.* -> satisfiable by ruflin/elastica[3.2, 3.2.1, 3.2.2, 3.2.3] but these conflict with your requirements or minimum-stability.

然后我运行composer require ruflin/elastica "3.2.*"并得到了这个:     您的要求无法解析为可安装的软件包。

  Problem 1
- The requested package friendsofsymfony/elastica-bundle (locked at 3.1.8, required as dev-master) is satisfiable by friendsofsymfony/elastica-bundle[3.1.8] but these conflict with your requirements or minimum-stability.

所以我的问题是我需要安装ruflin/elastica才能升级friendsofsymfony/elastica-bundle,但我还需要升级friendsofsymfony/elastica-bundle才能安装ruflin/elastica

如何才能正确完成?

由于

1 个答案:

答案 0 :(得分:4)

在运行require之前,不要认为有时需要从composer.json中删除旧版本。但要回答你的问题......我有两种选择,就像我看到它一样。

1:尝试在一个命令中安装两个新包

composer require ruflin/elastica:3.2.* friendsofsymfony/elastica-bundle:dev-master

2:只需手动编辑你的composer.json,然后运行composer update

"require": {
  "php": ">=5.3.9",
  "symfony/symfony": "2.8.*",
  "doctrine/orm": "^2.4.8",
  "doctrine/doctrine-bundle": "~1.4",
  ...
   "friendsofsymfony/elastica-bundle": "dev-master",
   "ruflin/elastica": "3.2.*"

},