Reputation: 1117
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?
Upvotes: 67
Views: 33664
Reputation: 1176
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
The Composer documentation covers it at Modifying Repositories (CLI: composer config).
Upvotes: 97