rmasters / github-service-provider
KnpLabs' GitHub API 包装器的 Pimple 服务提供者
v0.2.0
2014-07-25 21:31 UTC
Requires
- knplabs/github-api: ~1.2
- pimple/pimple: ~3.0
This package is not auto-updated.
Last update: 2024-09-24 03:13:12 UTC
README
为 Pimple (Silex, Cilex) 应用程序提供 KnpLabs GitHub API 包装器。
安装
-
使用 Composer 需求此包
composer require "rmasters/github-service-provider:~1.0"
-
在您的应用程序中注册
$app = new Silex\Application; $app = new Pimple\Container; $app->register(new Rossible\Provider\GitHubProvider\GitHubServiceProvider);
此包需要 Pimple 3.x,并使用它提供的 ServiceProviderInterface 和 Container 接口/类型提示。Silex 2.0 支持,Cilex 应该很快也会支持。
配置
您可以通过扩展这些服务来修改 GitHub\Client
的构造
要更改这些,请 扩展或替换服务,例如
// Toggle the caching variable $app['github.httpclient.caching'] = false; // Use a subdirectory in the temp directory $app->extend('github.httpclient.cache.path', function($path, $app) { $path .= '/github-responses'; mkdir($path, 776); return $path; }); // Set a custom Accept header to access pre-release features $app->extend('github.httpclient', function (HttpClientInterface $httpclient, $app) { $httpclient->setHeaders(['Accept' => 'application/vnd.github.she-hulk-preview+json']); return $httpclient; });
许可协议
在 MIT 许可协议 下发布。