Useful Snippets

Welcome!


This blog is used to collect useful snippets related to Linux, PHP, MySQL and more. Feel free to post comments with improvements or questions!

Are your smart devices spying on you? Make better purchasing choices and find products that respect your privacy at Unwanted.cloud

RSS Latest posts from my personal blog


Subscribe to RSS feed


Composer: Using your own fork for a package

Stanislav KhromovStanislav Khromov

Modifying a Composer library that is on Packagist is easy! Follow the steps below:

Before (Using official Packagist repo)

{
    "require":
    {
        "torophp/torophp": "dev-master"
    }
}

After (Overriding with your own fork)

{
    "repositories":
    [
            {
                "type": "vcs",
                "url": "https://github.com/khromov/ToroPHP"
            }
    ],
    "require":
    {
        "torophp/torophp": "dev-master"
    }
}

Now you can run:

composer update 

Composer should tell you that files have been modified. Answer “Y” to any questions. Congratulations! You are now using your own fork.

Full-stack impostor syndrome sufferer & Software Engineer at Schibsted Media Group

Comments 5
  • Owen
    Posted on

    Owen Owen

    Reply Author

    Thanks, note that for this to work I needed to change the “minimum-stability” option in composer.json in my own branch to “dev”.


  • Owen
    Posted on

    Owen Owen

    Reply Author

    Actually this was not the issue. I created a branch inside my fork on github and called it “dev-custom”. It should have been just “custom” for Composer to be able to find it!