ckrupa / hubic-api-bundle
一个简化对hubic.com API调用过程的symfony2服务包装器
dev-master / 1.0.x-dev
2015-04-04 16:30 UTC
Requires
- hwi/oauth-bundle: 0.3.*
- sensio/buzz-bundle: ~1.0
- symfony/symfony: >=2.6
This package is not auto-updated.
Last update: 2024-09-28 17:21:07 UTC
README
此包提供对hubiC-API(https://api.hubic.com/)的简单集成,适用于Symfony2。API包装器不是“官方”的hubic.com PHP/Symfony2库!
用法
<?php
$hubic_api = $this->container->get('ckrupa_hubic_api');
if(!$hubic_api->isLoggedIn())
{
die('invalid oauth token!');
}
$result = $hubic_api->send('/account/credentials');
安装
步骤1:Composer require
$ php composer.phar require "ckrupa/hubic-api-bundle":"dev-master"
步骤2:在内核中启用包
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new HWI\Bundle\OAuthBundle\HWIOAuthBundle(),
new Sensio\Bundle\BuzzBundle\SensioBuzzBundle(),
new Ckrupa\HubicApiBundle\CkrupaHubicApiBundle(),
// ...
);
}
步骤3:设置OAuth
OAuth通过HWIOAuthBundle完成,请查阅文档。
示例配置
以下是一个hwi 0.3的示例配置