chocoboxxf / yii2-teleii-sdk
Teleii API for Yii 2.0
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- php: >=5.4.0
- guzzlehttp/guzzle: ~5.0
- yiisoft/yii2: *
Requires (Dev)
- phpunit/phpunit: >=4.0
This package is not auto-updated.
Last update: 2024-11-09 19:28:39 UTC
README
基于Yii2实现的啦米小智商务号API SDK(目前开发中)
环境条件
-
= PHP 5.4
-
= Yii 2.0
-
= GuzzleHttp 5.0
安装
添加下列代码在composer.json
文件中并执行composer update --no-dev
操作
{ "require": { "chocoboxxf/yii2-teleii-sdk": "dev-master" } }
设置方法
// 全局使用 // 在config/main.php配置文件中定义component配置信息 'components' => [ ..... 'teleii' => [ 'class' => 'chocoboxxf\Teleii\Teleii', 'id' => '123', // 接入商id 'key' => 'ABCXYZ1234567', // 接入商key 'host' => '127.0.0.1', // API地址 'port' => '8000', // API端口 ] .... ] // 代码中调用 $result = Yii::$app->teleii->bindMobile('14012345678', '13000000000'); ....
// 局部调用 $teleii = Yii::createObject([ 'class' => 'chocoboxxf\Teleii\Teleii', 'id' => '123', // 接入商id 'key' => 'ABCXYZ1234567', // 接入商key 'host' => '127.0.0.1', // API地址 'port' => '8000', // API端口 ]); $result = $teleii->bindMobile('14012345678', '13000000000'); ....
使用示例
商务号绑定接口
$result = Yii::$app->teleii->bindMobile('14012345678', '13000000000'); if ($result['result'] !== 0) { // 出错情况 return $result['error']; // 返回出错信息 .... } // 正常情况 ....