apistd/uni-sdk

0.1.0 2021-07-24 14:30 UTC

This package is auto-updated.

Last update: 2024-04-24 18:21:44 UTC


README

UniSMS - 高可用聚合短信服务平台官方 PHP SDK.

文档

查看完整产品介绍与 API 文档请访问 UniSMS Documentation.

安装

Uni PHP SDK 使用 Packagist 托管,可从公共 Packagist 仓库 中获得。

使用 Composer 在项目中添加 apistd/uni-sdk 作为依赖:

composer require apistd/uni-sdk

使用示例

以下示例展示如何使用 Uni PHP SDK 快速调用服务。

发送短信

use Uni\Common\UniException;
use Uni\SMS\UniSMS;

// 初始化
$client = new UniSMS([
  'accessKeyId' => 'your access key id',
  'accessKeySecret' => 'your access key secret'
]);

// 发送短信
try {
  $resp = $client->send([
    'to' => 'your phone number',
    'signature' => 'UniSMS',
    'templateId' => 'login_tmpl',
    'templateData' => [
      'code' => 7777
    ]
  ]);
  var_dump($resp->data);
} catch (UniException $e) {
  print_r($e);
}

相关参考

其他语言 SDK