how to install a package with composer from github 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"
    }
]