panda843 / github-api
GitHub API v3 客户端
3.8.1
2022-09-07 10:38 UTC
Requires
- php: ^7.2.5 || ^8.0
- ext-json: *
- php-http/cache-plugin: ^1.7.1
- php-http/client-common: ^2.3
- php-http/discovery: ^1.12
- php-http/httplug: ^2.2
- php-http/multipart-stream-builder: ^1.1.2
- psr/cache: ^1.0|^2.0|^3.0
- psr/http-client-implementation: ^1.0
- psr/http-factory-implementation: ^1.0
- psr/http-message: ^1.0
- symfony/deprecation-contracts: ^2.2|^3.0
- symfony/polyfill-php80: ^1.17
Requires (Dev)
- guzzlehttp/guzzle: ^7.2
- guzzlehttp/psr7: ^1.7
- http-interop/http-factory-guzzle: ^1.0
- php-http/mock-client: ^1.4.1
- phpstan/extension-installer: ^1.0.5
- phpstan/phpstan: ^0.12.57
- phpstan/phpstan-deprecation-rules: ^0.12.5
- phpunit/phpunit: ^8.5 || ^9.4
- symfony/cache: ^5.1.8
- symfony/phpunit-bridge: ^5.2
- dev-master / 3.9.x-dev
- 3.8.1
- v3.8.0
- v3.7.0
- v3.6.0
- v3.5.1
- v3.5.0
- v3.4.0
- v3.3.0
- v3.2.0
- v3.1.0
- v3.0.0
- 2.x-dev
- v2.20.0
- v2.19.2
- v2.19.1
- v2.19.0
- v2.18.0
- v2.17.0
- v2.16.0
- v2.15.0
- v2.14.0
- 2.13.0
- 2.12.1
- 2.12.0
- 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
This package is auto-updated.
Last update: 2024-09-07 15:02:40 UTC
README
一个简单的面向对象的 GitHub API 包装器,使用 PHP 编写。
使用 GitHub API v3 并支持 GitHub API v4。对象 API(v3)与 RESTful API 非常相似。
功能
- 由于 API 类的延迟加载,轻量且快速
- 广泛测试和文档化
要求
快速安装
通过 Composer。
此命令将快速使用 Guzzle HTTP 客户端启动。
composer require knplabs/github-api:^3.0 guzzlehttp/guzzle:^7.0.1 http-interop/http-factory-guzzle:^1.0
高级安装
我们通过 HTTPlug 的帮助与任何 HTTP 消息客户端解耦。
使用不同的 http 客户端
composer require knplabs/github-api:^3.0 symfony/http-client nyholm/psr7
要使用此 HTTP 客户端设置 Github 客户端
use Github\Client; use Symfony\Component\HttpClient\HttplugClient; $client = Client::createWithHttpClient(new HttplugClient());
在我们的文档中了解更多关于 使用不同客户端 的信息。
框架集成
Laravel
为了在 Laravel 中集成此库,Graham Campbell 创建了 graham-campbell/github。查看 安装说明 以在 Laravel 中开始。
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 API 端点。
缓存使用
此示例使用 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 的贡献。
- 感谢 Emre DEGER 对 Actions API 的贡献。
感谢 GitHub 提供高质量的 API 和文档。