osteel's blog Web development resources

How to use the fork of a repository with Composer

Composer and GitHub

When using packages maintained by other developers, you often find yourself waiting for a fix, an update or the merge of a PR that will come with the next release but you need it now. A workaround is to fork the corresponding repository (which you may have done already if you are the author of the PR), make the updates you need and then use your fork in your project instead of the original package.

If I wanted to use a fork of Guzzle for example, I would edit composer.json like so (osteel is my GitHub username):

    "name": "osteel/myproject",  
    "description": "My project.",  
    "license": "MIT",  
    "type": "project",  
    "repositories": [  
            "type": "vcs",  
            "url": "https://github.com/osteel/guzzle"  
    "require": {  
        "laravel/lumen-framework": "5.1.*",  
        "guzzlehttp/guzzle": "dev-master"  

This would use the master branch of my fork (replace master with whichever branch name you want to use).

Don't forget to watch the original repository to be aware of new releases, or use http://gh-release-watch.com if you don't want to get notifications for all the issues, conversations, etc (while GitHub is considering the possibility of watching for releases only).

Last updated by osteel on the :: [ composer github fork repository php ]

Like this?

You can unsubscribe at any time by clicking the link in the footer of the emails.
By clicking to subscribe, you acknowledge that your email address will be transferred to Mailchimp for processing.
Learn more about Mailchimp's privacy practices here.