composer GitHub repository code example

Example 1: git get repo with composer

"repositories": [
    {
        "type":"package",
        "package": {
          "name": "l3pp4rd/doctrine-extensions",
          "version":"master",
          "source": {
              "url": "https://github.com/l3pp4rd/DoctrineExtensions.git",
              "type": "git",
              "reference":"master"
            }
        }
    }
],
"require": {
    "l3pp4rd/doctrine-extensions": "master"
}

Example 2: install composer package from github

"repositories":[
    {
        "type": "vcs",
        "url": "[email protected]:barryvanveen/secret.git"
    }
]

Example 3: composer add git repository

composer config repositories.secret '{"type": "vcs","url": "[email protected]:barryvanveen/secret.git"}'