一个简单的 PHP GitHub API 客户端,采用面向对象设计,已经过测试和记录。
一个简单的面向对象封装器,用于 GitHub API,使用 PHP 编写。 使用 GitHub API v3 并支持 GitHub API v4。对象 API (v3) 与 RESTful 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 消息客户端脱钩。
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 中集成此库, 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 <?php // 此文件是由生成的
暂无开放 Issues,或尚未同步最近议题。