rmasters / github-service-provider
Pimple service provider for KnpLabs' GitHub API wrapper
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-11-05 04:04:15 UTC
README
Provides the KnpLabs GitHub API wrapper to Pimple (Silex, Cilex) applications.
Installation
-
Composer require this package:
composer require "rmasters/github-service-provider:~1.0"
-
Register in your application:
$app = new Silex\Application; $app = new Pimple\Container; $app->register(new Rossible\Provider\GitHubProvider\GitHubServiceProvider);
This package requires Pimple 3.x and uses the ServiceProviderInterface and Container interfaces/type-hints that it provides. Silex 2.0 supports this, and Cilex should do soon.
Configuration
You can modify the GitHub\Client
construction by extending these services:
To change these, extend or replace the service, for example:
// 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; });
License
Released under the MIT License.