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!

RSS Latest posts from my personal blog


Most viewed posts


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.

Web Developer at Aftonbladet (Schibsted Media Group)
Any opinions on this blog are my own and do not reflect the views of my employer.
LinkedIn
Twitter
WordPress.org Profile
Visit my other blog

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!