4
votes

First, there are some related posts which does not really fit to my problem.

and some more.

I have a Symfony Project which contains some private packages. These are referenced by vcs:

"repositories": [
    {
        "type": "vcs",
        "url": "[email protected]"
    },
    {
        "type": "vcs",
        "url": "[email protected]"
    },
    {
        "type": "vcs",
        "url": "[email protected]"
    }
],

This works like expected. But, the private package yyyy referenced to another private package (lets call it sub-yyyy), which is also referenced by type vcs in the package composer.json file.

If i run composer install it fails with the message:

Problem 1 - Installation request for yyyy -> yyyy]. - yyyy requires sub-yyyy ^1.0.0 -> no matching package found.

Potential causes:

The private package (sub-yyyy) ist tagged by v1.0.0, and could be installed if its in the composer.json file of the main project.

The composer.json of the main project (cutted out required):

{
    "name": "main/project",
    "license": "proprietary",
    "type": "project",
    "prefer-stable": true,
    "repositories": [
        {
            "type": "vcs",
            "url": "[email protected]"
        },
        {
            "type": "vcs",
            "url": "[email protected]"
        },
        {
            "type": "vcs",
            "url": "[email protected]"
        }
    ],
}

The composer.json of the yyyy package:

{
  "name": "yyyy",
  "type": "symfony-bundle",

  "require": {
    "sub-yyyy": "^1.0.0"
  },

  "repositories": [
    {
      "type": "vcs",
      "url": "[email protected]"
    }
  ],
  "minimum-stability": "dev",
}

Any ideas to fix the problem when i install the yyyy package which references sub-yyyy?

1

1 Answers

5
votes

You have to add repository entry to package sub-yyyy in your main project as dependencies entry is not transitive.

From docs

Repositories are not resolved recursively. You can only add them to your main composer.json. Repository declarations of dependencies' composer.jsons are ignored.

Your composer.json of main project should look like

{
    "name": "main/project",
    "license": "proprietary",
    "type": "project",
    "prefer-stable": true,
    "repositories": [
        {
            "type": "vcs",
            "url": "[email protected]"
        },
        {
            "type": "vcs",
            "url": "[email protected]"
        },
        {
            "type": "vcs",
            "url": "[email protected]"
        },
        {
            "type": "vcs",
            "url": "[email protected]"
        }
    ]
}