kekekiw123's avatar

How do I use an forked package with composer

I had to make some changes to an package. So I did a fork and then pushed in my changes to my fork repo.

How do I now tell composer to use my fork/repo of that package?

Before I had to use my fork I did it by:

"fairholm/elasticquent": "master-dev"

If the master brach gets updated, does my fork aswell? I dont want my fork to get updated once the master gets an new update.

0 likes
2 replies
RemiC's avatar
RemiC
Best Answer
Level 8

To use your fork, add a repository to your composer.json :


    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/yourpackage"
        }
],

Composer will load your version instead of the main repo, even if the latter get updated. And your repo won't get auto updated unless you manually update it with a pull request.

Are you sure also your branch is correct, shouldn't you have :

"fairholm/elasticquent": "dev-master"

?

2 likes

Please or to participate in this conversation.