Using forked composer packages

Sometimes you need to make a change to a public composer package (e.g. I needed to add Laravel 7 support to a plugin, example below) but you can’t wait for the upstream provider to merge it, or are not interested in asking for this change to be merged and want to use the package as intended but with your Github repos version.

Firstly, add the original package to your composer.json with “dev-master”, like so:

"require": {
    ...
    "kriosmane/coinmarketcap-api": "dev-master",
    ...
}

Then below add a new section called repositories, like so:

    "repositories": [
        {
            "type": "vcs",
            "url":  "https://github.com/dbfx/coinmarketcap-api"
        }
    ],

This will cause kriosmane/coinmarketcap-api to be loaded from dbfx/coinmarketcap-api instead. Run a composer update and you are done.

Got Something To Say?

Your email address will not be published. Required fields are marked *