evandotpro/edp-github

为 Zend Framework 2 集成的 Github API 模块

0.4.0 2015-10-24 07:29 UTC

This package is not auto-updated.

Last update: 2024-09-10 05:00:37 UTC


README

Build Status Coverage Status

简介

EdpGithub 是基于 Zend Framework 2 的 Github API 包装器,它使用了 Github API v3

安装

主要设置

  1. 将此项目克隆到您的 ./vendor/ 目录,并在您的 application.config.php 文件中启用它。

用法

基本用法

以下是如何使用的简短示例

$client = $serviceManager->get('EdpGithub\Client');
$repos = $client->api('user')->repos('hounddog');

这将获取用户 Hounddog 的所有仓库

认证

要使用需要认证的功能,您必须首先进行认证

$client = $serviceManager->get('EdpGithub\Client');
$client->authenticate('url_token', 'access_token');
$repos = $client->api('current_user')->repos();

您也可以监听事件 'EdpGithub\Client', 'api'

$em->attach('EdpGithub\Client', 'api', function($e) use ($sm) {
    $client = $e->getTarget();
    $client->authenticate('url_token', $token /* your access_token here */);
} );

文档

请参阅 Wiki 以获取更详细的文档