codecamplao / telbiz
电信服务
v1.0.03
2022-07-26 01:18 UTC
Requires
- guzzlehttp/guzzle: ^7.4
README
安装
首先通过Composer安装此包。只需在终端运行以下命令即可-
composer require codecamplao/telbiz
您还可以编辑项目的 composer.json
文件以要求 codecamplao/telbiz
。
"require": { "codecamplao/telbiz": "^1.0" }
接下来,从终端更新Composer
composer update
一旦此操作完成,最后一步是添加服务提供者。打开 config/app.php
,并在提供者数组中添加一个新条目。
'providers' => [ // ... CodeCampLAO\TelBiz\TelBizServiceProvider::class, ]
接下来,在环境文件中添加更多配置。打开 .env
,并添加如下所示的新三个配置。
TELBIZ_BASE_URI="" TELBIZ_CLIENT_ID="" TELBIZ_CLIENT_SECRET=""
示例用法
protected $telbiz_sms; public function __construct() { $this->telbiz_sms = new TelBizSMS(); } public function index(): Response { return $this->telbiz_sms->sendSmsService(TitleEnum::Default, '20xxxxxxxx', 'Hello Telbiz'); }
示例响应
{ "response": { "code": "SUCCESS_OPERATION", "message": "Success", "success": true, "detail": "Success" }, "key": { "partitionKey": "16512253832870000", "rangeKey": "16538405678928228" } }