hounddog / hd-api-client
Zend Framework 2 模块,提供基础API功能
dev-master
2014-06-24 13:19 UTC
Requires
- php: >=5.3.3
- zendframework/zend-eventmanager: 2.*
- zendframework/zend-filter: 2.*
- zendframework/zend-http: 2.*
- zendframework/zend-modulemanager: 2.*
- zendframework/zend-servicemanager: 2.*
Requires (Dev)
- phpunit/phpunit: 3.7.*
- satooshi/php-coveralls: >=0.6.0
- squizlabs/php_codesniffer: 1.4.*
This package is not auto-updated.
Last update: 2024-09-10 01:47:17 UTC
README
简介
HdClientApi 是基于 Zend Framework 2 的一个连接器,用于各种基于 API 的模块(例如 Github、Twitter、Instagram 等)。
安装
主要设置
- 将此项目克隆到您的
./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 以获取更详细的文档