Skip to content

Instantly share code, notes, and snippets.

@igorw
Last active May 22, 2023 13:23
Show Gist options
  • Save igorw/2145730 to your computer and use it in GitHub Desktop.
Save igorw/2145730 to your computer and use it in GitHub Desktop.
Composer PR Template

Composer is a new dependency manager for PHP. It allows you to specify dependencies on a per-project basis. It takes lots of inspiration from NPM and ruby's bundler.

All you need to support composer is a composer.json file. In order to allow easy installation, the repository needs to be added to packagist, which is the standard repository for composer. Packagist will fetch all the versions from your github repository tags.

Once it has been added, adding {PROJECT} to a project will be as easy as creating this composer.json file in the project's directory:

{
    "require": {
        "{VENDOR}/{PROJECT}": "{VERSION}"
    }
}

And running this command:

$ php composer.phar install

Note: Packagist will re-crawl github for new versions all the time. After submitting it once (and setting up the github post-commit hook), you don't have to do anything else.

Check out the following information on composer and packagist:

Cheers!

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