Search code examples
symfonycomposer-phpelasticafoselasticabundle

How to install 2 Symfony bundles at the same time with composer which depend on each other


I want to upgrade friendsofsymfony/elastica-bundle from 3.1.* to dev-master.

You can see bellow my current composer.json setting:

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

The problem is when I remove the row friendsofsymfony/elastica-bundle and then run 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.

Then I run composer require ruflin/elastica "3.2.*" and got this : Your requirements could not be resolved to an installable set of packages.

  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.

So my problem is that I need to install ruflin/elastica in order to upgrade friendsofsymfony/elastica-bundle but I also need to upgrade friendsofsymfony/elastica-bundle to install ruflin/elastica

How can I manage to do it properly ?

Thanks


Solution

  • Don't think there is really a time you would need to remove the older version from your composer.json before running a require. But to answer your question ... You have two options the way I see it.

    1: try and install both new packages in one command

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

    2: just manually edit your composer.json and then run 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.*"
    
    },