I pull in a package using Composer with this composer.json:
{
"require": {
"torophp/torophp": "dev-master",
},
}
When I run composer install it seems to pull this package from GitHub directly.
I have created a fork of that repo on github with some small changes. Is there a way I can get composer to pull my version on GitHub instead of the original?
If this is your
composer.jsonand you want to change it and use your fork instead, just add your repository into
composer.jsonas follows:Important: Do not change the
"require"part, it must continue usingtorophp/torophp!After adding the
"repositories"part, run acomposer update(orcomposer.phar update) and composer will then download your fork (even though it echoes “installing torophp/torophp” during the operation).Update (18.09.2014): As mentioned by @efesaid in the comments:
Note: For those having issues with pulling from the HTTP(S) source (ie you get
[RuntimeException] Failed to clone https://github.com/your-github-username/torophp, could not read packages from itwhen trying to update), you can change thecomposer.jsonto use the git protocol instead. To do so, change thecomposer.jsonas follows and runcomposer updateagain.Now go into
vendor/torophp/torophpand rungit remote -vfor a double check that you use the desired source for the repository.From there you can commit the changes to your fork and update it from origin (
git pull origin master).Update: To work with private repositories at GitHub, you must use git protocol and also must have installed SSH keys for a git client.
Composer reference: Loading a package from a VCS repository