guillermoandrae / php-github
GitHub API 的 PHP 客户端库。
0.3.0
2015-03-11 02:08 UTC
Requires
- php: >=5.4.0
- doctrine/cache: @stable
- guzzlehttp/cache-subscriber: 0.1.*@dev
- guzzlehttp/guzzle: ~5.0
- icanboogie/inflector: @stable
Requires (Dev)
- phing/phing: @stable
- phpunit/phpunit: ~4.0
- squizlabs/php_codesniffer: @stable
This package is auto-updated.
Last update: 2024-09-29 04:49:09 UTC
README
GitHub API 的 PHP 客户端库。GitHub API。
安装
推荐使用 Composer 安装此库。
{
"require": {
"guillermoandrae/php-github": "*"
}
}
基本用法
基本客户端使用 Guzzle 与 GitHub API 进行通信。客户端的实例化非常直接
// create the client $client = new GitHub\Client\Client();
资源以对象的形式表示,并通过对象映射器获取资源数据
// pick a resource and get some useful data, like so... $users = $client->resource('user')->findAll(); foreach ($users as $user) { printf('%s has %d followers.', $user->getLogin(), $user->getNumFollowers()); echo PHP_EOL; } // or like so... $org = $client->resource('organization')->find('github'); echo $org->getLocation(); // .. and rejoice! echo 'YEESSSSSSSSSSSS!';