1

I have a fresh symfony application, a satis install (internal package manager) and 2 bundles.

The application requires bundle 1.

Bundle 1 requires bundle 2.

Bundle 2 requires additional bundles from packagist.

When running composer update on the Application, it fails, stating that "bundle1 dev-master requires bundle2 dev-master -> no matching package found.

However...

When I modify the application to require both bundle 1 and 2, everything comes through as expected.

What am I doing wrong here?

Application composer.json:

{
    "name": "symfony/framework-standard-edition",
    "license": "MIT",
    "type": "project",
    "description": "The \"Symfony Standard Edition\" distribution",
    "autoload": {
        "psr-0": { "": "src/" }
    },
    "repositories": [
        {
            "type": "composer",
            "url": "http://bundles.internalservername.com"
        }
    ],
    "require": {
        "php": ">=5.3.3",
        "symfony/symfony": "~2.4",
        "doctrine/orm": "~2.2,>=2.2.3",
        "doctrine/doctrine-bundle": "~1.2",
        "twig/extensions": "~1.0",
        "symfony/assetic-bundle": "~2.3",
        "symfony/swiftmailer-bundle": "~2.3",
        "symfony/monolog-bundle": "~2.4",
        "sensio/distribution-bundle": "~2.3",
        "sensio/framework-extra-bundle": "~3.0",
        "sensio/generator-bundle": "~2.3",
        "incenteev/composer-parameter-handler": "~2.0",
        "ec/data/feeds/product-pool-data-service-bundle": "dev-master"
    },
    "scripts": {
        "post-install-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
        ],
        "post-update-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
        ]
    },
    "config": {
        "bin-dir": "bin"
    },
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        },
        "branch-alias": {
            "dev-master": "2.4-dev"
        }
    }
}

bundle 1 (ec/data/feeds/product-pool-data-service-bundle) composer.json:

{
    "name": "ec/data/feeds/product-pool-data-service-bundle",
    "type": "symfony-bundle",
    "description": "Data Service Bundle for Feeds Product Pool",
    "keywords": ["data", "product pool", "feeds"],
    "homepage": "http://internalservername.com/projects/ec/repos/productpooldataservicebundle/browse",
    "license": "MIT",
    "repositories": [
        {
            "type": "composer",
            "url": "http://bundles.internalservername.com"
        }
    ],
    "require": {
        "php": ">=5.3.2",
        "ec/generic-service-bundle": "dev-master"
    },
    "require-dev": {
        "symfony/framework-bundle": ">=2.1,<2.2-dev"
    },
    "autoload": {
        "psr-0": { "Ec\\ProductPoolDataServiceBundle": "" }
    },
    "minimum-stability": "dev",
    "target-dir": "",
    "version": "0.0.1-dev"
}

bundle 2 (ec/generic-service-bundle) composer.json

{
    "name": "ec/generic-service-bundle",
    "type": "symfony-bundle",
    "description": "Generic service bundle that all Ec REST services will extend.",
    "keywords": ["generic", "service", "ecentria", "rest"],
    "homepage": "http://internalservername.com/projects/EC/repos/genericservicebundle/browse",
    "license": "MIT",
    "repositories": [
        {
            "type": "composer",
            "url": "http://bundles.internalservername.com"
        }
    ],
    "require": {
        "php": ">=5.3.2",
        "friendsofsymfony/rest-bundle": "1.3.*",
        "jms/serializer-bundle": "0.13.*",
        "willdurand/rest-extra-bundle": "@stable"
    },
    "require-dev": {
        "symfony/framework-bundle": ">=2.1,<2.2-dev"
    },
    "autoload": {
        "psr-0": { "Ec\\GenericServiceBundle": "" }
    },
    "minimum-stability": "dev",
    "target-dir": "Ec/GenericServiceBundle",
    "version": "0.0.1-dev"
}
pmcgovern
  • 71
  • 8
  • The repositories, minimum-stability and require-dev are root-only which means you can't use them in the composer.json of your packages. Also why are you specifying version explicitly? This is normally done with Git tags. – gezpage May 15 '14 at 13:25
  • 1
    RESOLUTION: Sorry - it's a little buried in comments of the accepted answer. I was trying to have a required bundle require another bundle in a development version, which isn't allowed (for good reason). TO get non-packagist bundles to require each other, make sure you greate tags in git for those repos and reference those versions. gezpage lists some useful links and comments in the accepted answer. – pmcgovern May 16 '14 at 16:37

2 Answers2

1

You need to specify minimum-stability: dev in your application composer.json. This will have no affect by adding it to the composer.json in your packages.

Also take out repositories, minimum-stability and require-dev from all of your package composer.json files as they are root-only

https://getcomposer.org/doc/04-schema.md#minimum-stability

gezpage
  • 441
  • 4
  • 11
  • Adding this in the application's composer.json file nets me dev versions of *everything*. I'm asusming this means I would be better suited to mark my packages as version 1.0.0 and removing the minimum-stability: dev from the application's composer.json? – pmcgovern May 15 '14 at 13:34
  • In that case you will need to create a branch alias in the package and then explicitly call that version alias with an @ symbol https://getcomposer.org/doc/articles/aliases.md – gezpage May 15 '14 at 13:41
  • I have fought with Satis and Composer to get things working well, make sure you read through the docs, and this is a good article also https://igor.io/2013/01/07/composer-versioning.html – gezpage May 15 '14 at 13:45
  • I've played with a lot of the options you've presented, but am still unable to get bundle1 to load bundle 2. Here are the updated composer files - what else am I missing? http://pastebin.com/PE9efNtc – pmcgovern May 15 '14 at 14:27
  • Ok I have been investigating and it appears that requiring a dev package inside a dependency is not possible. See this issue on Github for discussion https://github.com/composer/satis/issues/52. I suggest you only use your project composer.json to include dev packages and when you are ready for production you can tag your packages with appropriate stable versions. – gezpage May 16 '14 at 14:23
  • gezpage, I can't thank you enough for taking the time you did on this one. You are correct. I will have to create tags for each bundle to be able to have multi-bundle dependancy. It makes sense - only the root application can request development versions - allowing bundles to do so would create a cascade of un-trustable dependencies. – pmcgovern May 16 '14 at 16:33
0

Bundle 1 requires an unstable version of bundle 2, that's why it doesn't work, because by default Composer only allows stable packages. You have to set the minimum-stability flag in your application's composer.json to dev if you want this to work.

However, if you only want to allow those two dependencies to be in dev stability, then you should add bundle 2 to your application's composer.json manually.

Edit

I see that you have set the minimum-stability for bundle 1, however, Composer only looks at the minimum-stability of the root (application) composer.json. So simply add

"minimum-stability": "dev" 

to the application's composer.json.

Nic Wortel
  • 11,155
  • 6
  • 60
  • 79