scribe/github-api-bundle

此包已被 废弃,并且不再维护。没有建议的替代包。

PHP5 的 GitHub API 客户端

v1.3.1 2014-10-09 03:37 UTC

This package is not auto-updated.

Last update: 2022-02-01 12:33:19 UTC


README

Build Status Quality Score Coverage Status Dependency Status Latest Version Software License

这是一个简单的、面向对象的 PHP5 客户端,用于GitHub 的 API (v3),实现了一个与 GitHub 本地 RESTful API 相似的 API。

特性

  • 代码规范:实现了 PSR-0 代码和结构标准,以便使用 Composer 或其他类自动加载解决方案进行自动加载。
  • 速度和熟悉度:轻量级、快速且友好的对象模型,利用懒加载并故意与 GitHub 的自身 RESTful API 相似。
  • 测试和持续集成:广泛的 PHPUnit 测试,利用 Travis CI 作为我们的持续集成服务。
  • 质量、覆盖率和依赖:使用 Code Climate 的代码质量报告、使用 Coveralls 的覆盖率报告,并使用 Gemnasium 监控依赖版本。
  • 文档和示例:使用 markdown 编写的全面 示例 和自动生成的 API 文档

要求

此库需要少量依赖,无论是用于生产安装还是开发构建。

生产环境

开发环境

安装

您可以通过将依赖添加到 composer.json 项目文件的 require 部分来轻松地将此库包含到项目中 Composer

{
    "require": {
        "scribe/github-api-library": "dev-master"
    }
}

使用

基本使用

<?php

require_once 'vendor/autoload.php';

$client = new \Github\Client();
$repositories = $client->api('user')->repositories('ornicar');

缓存使用

<?php

require_once 'vendor/autoload.php';

$client = new \Github\Client(
    new \Github\HttpClient\CachedHttpClient(array('cache_dir' => '/tmp/github-api-cache'))
);

$client = new \Github\HttpClient\CachedHttpClient();
$client->setCache(
    new \Github\HttpClient\Cache\FilesystemCache('/tmp/github-api-cache')
);

$client = new \Github\Client($client);

文档

有关通用用法和示例,您可以查看doc目录。要查看全面API参考,请访问此项目的github.io网页

贡献者

此项目来自众多个人的贡献代码。