1
votes

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"
}
2
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
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

2 Answers

1
votes

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

0
votes

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.