Last Updated: September 09, 2019
·
5.861K
· erivello

Use my own fork of a third party library with Composer

If you need to use your fork of a third party library in a project managed with Composer, don't submit this fork to packagist but add your fork as a repository and update the version constraint to point to your custom branch.

Example (with Github):

{
    "repositories": [
        {
            "type": "vcs",
            "url": "http://github.com/erivello/third-party-library"
        }
    ],
    "require": {
        ....
        "foobar/third-party-library": "dev-fork"
        ....
    }
}

Now you can get the third-party-library from your Github instead of the one from packagist.

3 Responses
Add your response

really not clear: what is erivello forked or not?
what is foobar? forked or not?
is dev-fork branch or what?

over 1 year ago ·

"foobar/third-party-library" is the original library and "dev-fork" is the branch i need.
"erivello/third-party-library" is my fork of "dev-fork" branch.

So when i run "php composer.phar update", i should get my modified version of "foobar/third-party-library"

over 1 year ago ·

cool, thanks

over 1 year ago ·