Skip to content

Instantly share code, notes, and snippets.

@HermesMartins
Last active September 21, 2018 21:49
Show Gist options
  • Save HermesMartins/7dd1cba52280521a314a2be8993aebae to your computer and use it in GitHub Desktop.
Save HermesMartins/7dd1cba52280521a314a2be8993aebae to your computer and use it in GitHub Desktop.
Using a package with composer from local git repository

Using a package with composer from local git repository

This is a simple guide to use a package with composer from local git repository.

Imagine you have forked the repository bandwidth-throttle/token-bucket and pushed some changes on a branch called new-feature.

Now, you want to use it on another project. How to do this?

First, you need to do some changes on composer.json file in your main project.

Example (based on my git):

{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/HermesMartins/token-bucket"
        }
    ],
    "require": {
        "bandwidth-throttle/token-bucket": "dev-new-feature",
    }
}

Finally, you can update your composer and it will pull the package from local git repository.

That's it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment