Monday, January 24, 2022

[FIXED] Composer - multiple repositories from one project

Issue

when I want to install some library by composer, it's enough to write:

composer require vendor/library

and composer downloads it from github. It's not necessary to give url for every "vendor/library" to composer.json. Composer does it "internally". But when I'd like to add some library from e.g. bitbucket, I have to create this composer.json:

{
    "require": {
        "vendor/my-private-repo1": "dev-master",
        "vendor/my-private-repo2": "dev-master"
    },
    "repositories": [
        {
            "type": "vcs",
            "url":  "git@bitbucket.org:vendor/my-private-repo1.git"
        },
        {
            "type": "vcs",
            "url":  "git@bitbucket.org:vendor/my-private-repo2.git"
        }
    ]
}

I have to specify an url of every library I want to install, even if they are from the same project. Is there any way to make it shorter? Can I do something like this:

{
    "require": {
        "vendor/my-private-repo1": "dev-master",
        "vendor/my-private-repo2": "dev-master",
        "vendor/my-private-repo3": "dev-master",
        "vendor/my-private-repo4": "dev-master"
    },
    "repositories": [
        {
            "type": "vcs",
            "url":  "git@bitbucket.org:vendor/*"
        }
    ]
}

I hope my question is understandable. Thank you.


Solution

You either need to specify each repository separately, or manage your composer packages with satis or toran proxy. You'll still need to define your repositories, but only once (in satis or toran).



Answered By - Jakub Zalas

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.