muglug / github-api
GitHub API v3 客户端
2.11.0
2019-01-28 19:31 UTC
Requires
- php: ^5.6 || ^7.0
- php-http/cache-plugin: ^1.4
- php-http/client-common: ^1.6
- php-http/client-implementation: ^1.0
- php-http/discovery: ^1.0
- php-http/httplug: ^1.1
- psr/cache: ^1.0
- psr/http-message: ^1.0
Requires (Dev)
- cache/array-adapter: ^0.4
- guzzlehttp/psr7: ^1.2
- php-http/guzzle6-adapter: ^1.0
- php-http/mock-client: ^1.0
- phpunit/phpunit: ^5.5 || ^6.0
- dev-master / 2.12.x-dev
- 2.11.0
- 2.10.1
- 2.10.0
- 2.9.0
- 2.8.0
- 2.7.0
- 2.6.0
- 2.5.0
- 2.4.0
- 2.3.0
- 2.2.0
- 2.1.0
- 2.0.1
- 2.0.0
- 2.0.0-rc4
- 2.0.0-rc3
- 2.0.0-rc2
- 2.0.0-rc1
- 2.0.0-rc
- 1.7.x-dev
- 1.7.1
- 1.7.0
- 1.6.1
- 1.6.0
- 1.5.1
- 1.5.0
- 1.4.15
- 1.4.14
- 1.4.13
- 1.4.12
- 1.4.11
- 1.4.10
- 1.4.9
- 1.4.8
- 1.4.7
- 1.4.6
- 1.4.5
- 1.4.4
- 1.4.3
- 1.4.2
- 1.4.1
- 1.4.0
- 1.3.1
- 1.3.0
- 1.2.7
- 1.2.6
- 1.2.5
- 1.2.4
- 1.2.3
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.2
- 1.0.1
- 1.0.0
- 0.1
- dev-v3-dev
This package is auto-updated.
Last update: 2024-09-09 09:46:19 UTC
README
一个简单的 GitHub API 对象封装,使用 PHP 编写。
使用 GitHub API v3 并支持 GitHub API v4。对象 API (v3) 与 RESTful API 非常相似。
特性
- 由于 API 类的懒加载,轻量且快速
- 经过广泛测试和文档化
要求
安装
通过 Composer
$ composer require knplabs/github-api php-http/guzzle6-adapter "^1.1"
为什么是 php-http/guzzle6-adapter
? 我们通过 HTTPlug 与任何 HTTP 消息客户端解耦。在我们的 文档 中了解有关客户端的更多信息。
使用 Laravel 吗?
Graham Campbell 的 Laravel GitHub 可能会吸引你。
php-github-api
客户端的基本使用
<?php // This file is generated by Composer require_once __DIR__ . '/vendor/autoload.php'; $client = new \Github\Client(); $repositories = $client->api('user')->repositories('ornicar');
从 $client
对象中,你可以访问 GitHub 的所有内容。
缓存使用
此示例使用 PSR6 缓存池 redis-adapter。有关替代方案,请参阅 http://www.php-cache.com/。
<?php // This file is generated by Composer require_once __DIR__ . '/vendor/autoload.php'; use Cache\Adapter\Redis\RedisCachePool; $client = new \Redis(); $client->connect('127.0.0.1', 6379); // Create a PSR6 cache pool $pool = new RedisCachePool($client); $client = new \Github\Client(); $client->addCache($pool); // Do some request // Stop using cache $client->removeCache();
使用缓存,如果资源自上次以来没有更改,则客户端将获取缓存响应,无需 达到 GitHub 施加的 X-Rate-Limit
。
文档
有关更详细的文档,请参阅 doc
目录。
许可
php-github-api
根据 MIT 许可证授权 - 有关详细信息,请参阅 LICENSE 文件
鸣谢
赞助商
贡献者
- 感谢 Thibault Duplessis aka. ornicar 为此库的第一个版本做出的贡献。
- 感谢 Joseph Bielawski aka. stloyd 的贡献和支持。
- 感谢 noloh 在对象 API 方面的贡献。
- 感谢 bshaffer 在 Repo API 方面的贡献。
- 感谢 Rolf van de Krol 的无数贡献。
- 感谢 Nicolas Pastorino 在 Pull Request API 方面的贡献。
- 感谢 Edoardo Rivello 在 Gists API 方面的贡献。
- 感谢 Miguel Piedrafita 在 v4 & Apps API 方面的贡献。
感谢 GitHub 提供高质量的 API 和文档。