rmasters/github-service-provider 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

rmasters/github-service-provider

Composer 安装命令:

composer require rmasters/github-service-provider

包简介

Pimple service provider for KnpLabs' GitHub API wrapper

README 文档

README

Provides the KnpLabs GitHub API wrapper to Pimple (Silex, Cilex) applications.

Installation

  1. Composer require this package:

    composer require "rmasters/github-service-provider:~1.0"
    
  2. 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:

Service Description Default
github.client The Github\Client instance Github\Client
github.httpclient The HttpClient used for making requests CachedHttpClient
github.httpclient.caching When true, uses a CachedHttpClient true
github.httpclient.options Options array passed to HttpClient []
github.httpclient.cache The Response cache to use FilesystemCache
github.httpclient.cache.path When using FilesystemCache, where to store cached responses sys_get_temp_dir()

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.

统计信息

  • 总下载量: 10
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-07-25