dmyers / octogun
GitHub v3 API的简单封装
v0.0.5
2017-08-09 16:12 UTC
Requires
- php: >=5.3.2
- kriswallsmith/buzz: >= 0.6
Requires (Dev)
- phpunit/phpunit: 3.7.*
- satooshi/php-coveralls: dev-master
README
简单的GitHub API PHP封装。这是Octokit.rb的非官方PHP版本。目标是实现不同语言之间的功能一致性。
安装
使用composer进行安装
$ composer require dmyers/octogun
示例
显示用户信息
$client = \Octogun\Octogun::users(); $client->user('sferik');
显示仓库信息
$client = \Octogun\Octogun::repositories(); $client->repo('octogun/octogun.rb');
认证请求
对于需要认证的方法,您需要使用您的用户名和密码设置一个客户端。
$client = new \Octogun\Client(['login' => 'me', 'password' => 'sekret']); $client->users()->follow('sferik');
或者,您可以使用GitHub OAuth2令牌进行认证。
$client = new \Octogun\Client(['login' => 'me', 'oauth_token' => 'oauth2token']); $client->users()->follow('sferik');
与GitHub Enterprise一起使用
要在GitHub Enterprise中使用,您需要在实例化客户端之前设置API和Web端点。
$client = new \Octogun\Client(['login' => 'USERNAME', 'password' => 'PASSWORD']); $client->configuration()->set('api_endpoint', 'https://github.company.com/api/v3'; $client->configuration()->set('web_endpoint', 'https://github.company.com/';
版权
版权(c)2013 Derek Myers。有关详细信息,请参阅[LICENSE][]。[license]: LICENSE.md