Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Composer - multiple repositories from one project

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":  "[email protected]:vendor/my-private-repo1.git"
        },
        {
            "type": "vcs",
            "url":  "[email protected]: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":  "[email protected]:vendor/*"
        }
    ]
}

I hope my question is understandable. Thank you.

like image 242
Honza Avatar asked Mar 02 '16 09:03

Honza


People also ask

Can a project have multiple repositories GitHub?

If you are working on a big project, then it is inevitable that you need to work with multiple repositories. That's why you need to sync your local code base with multiple Git remote repositories. For example, if your source code is: On Github for issues tracking.

How do I add a repository to Composer?

You can add more repositories to your project by declaring them in composer. json . Repositories are only available to the root package and the repositories defined in your dependencies will not be loaded. Read the FAQ entry if you want to learn why.

How do I make multiple repositories in GitHub?

Create an 'origin' remote pointing to your GitHub fork by using git clone. Create an 'upstream' remote pointing to a project main repository. Create an 'upstream-pull' remote containing a branch for every PR in the upstream repository. Create an 'origin-pull' remote containing a branch for every PR to your own ...

What is private Packagist?

Private Packagist is a commercial package hosting product offering professional support and web based management of private and public packages, and granular access permissions.


1 Answers

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).

like image 119
Jakub Zalas Avatar answered Sep 28 '22 07:09

Jakub Zalas