evandotpro / edp-github
为 Zend Framework 2 集成的 Github API 模块
0.4.0
2015-10-24 07:29 UTC
Requires
- php: >=5.5
- zendframework/zend-eventmanager: ~2.3
- zendframework/zend-filter: ~2.3
- zendframework/zend-http: ~2.3
- zendframework/zend-servicemanager: ~2.3
Requires (Dev)
- fabpot/php-cs-fixer: ~1.4
- phpunit/phpunit: 3.7.*
- satooshi/php-coveralls: >=0.6.0
This package is not auto-updated.
Last update: 2024-09-10 05:00:37 UTC
README
简介
EdpGithub 是基于 Zend Framework 2 的 Github API 包装器,它使用了 Github API v3。
安装
主要设置
- 将此项目克隆到您的
./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 以获取更详细的文档