github AOuth

まずComposerを入れます。

$ curl -sS https://getcomposer.org/installer | php

composer.jsonの作成

$ php composer.phar init
[vagrant@localhost api]$ ls
composer.json  composer.phar  google-api-php-client
[vagrant@localhost api]$ sudo mv composer.phar /usr/local/bin/composer

GitHubでApplicationをregisterして、Client IDとClient Secretを取得します。
https://github.com/settings/developers

composerで入れます。

[vagrant@localhost api]$ composer require league/oauth2-client league/oauth2-github
Using version ^2.3 for league/oauth2-client
Using version ^2.0 for league/oauth2-github
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 7 installs, 0 updates, 0 removals
  - Installing paragonie/random_compat (v2.0.11): Downloading (100%)
  - Installing guzzlehttp/promises (v1.3.1): Downloading (100%)
  - Installing psr/http-message (1.0.1): Downloading (100%)
  - Installing guzzlehttp/psr7 (1.4.2): Downloading (100%)
  - Installing guzzlehttp/guzzle (6.3.0): Downloading (100%)
  - Installing league/oauth2-client (2.3.0): Downloading (100%)
  - Installing league/oauth2-github (2.0.0): Downloading (100%)
paragonie/random_compat suggests installing ext-libsodium (Provides a modern crypto API that can be used to generate random bytes.)
guzzlehttp/guzzle suggests installing psr/log (Required for using the Log middleware)
Writing lock file
Generating autoload files
[vagrant@localhost api]$ ls
composer.json  composer.lock  google-api-php-client  vendor