Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add non-public repositories from command line with composer?

I want to add a new package which is not at packagist, it's a local or non-public repository. I know how to this in the composer.json. For example:

"repositories": [     {         "type": "vcs",         "url": "https://bitbucket.org/xxxx/xxxxx.git"     } ], "require": {     "xxxx/xxxxx": "dev-master" }, 

But I want to do this from the command line so that I can add this non-public repositories in a provision file. Packages registered at Packagist I can add with:

composer require .... 

But how to handle this with repositories not registered at Packagist?

like image 576
brasileric Avatar asked Jul 31 '15 09:07

brasileric


1 Answers

You can run the following from the project root to add a repository to the project's composer.json:

composer config repositories.repo-name vcs https://github.com/<orgname or username>/repo 

Then you can require the specific repo with:

composer require <orgname or username>/repo:dev-branchname 
like image 178
Matt A Avatar answered Sep 23 '22 05:09

Matt A