vicens/alidayu

阿里云通信(阿里大于)SDK

v1.1.1 2018-02-03 02:23 UTC

This package is auto-updated.

Last update: 2024-04-29 03:50:48 UTC


README

Build Status Scrutinizer Code Quality Latest Stable Version Total Downloads License

阿里云通信(阿里大于)SDK

阿里大于,是阿里通信旗下优质便捷的云通信服务平台,整合了三大运营商的通信能力,为开发者提供简洁易用的短信/语音API,三网合一通道,按需付费。阿里集团技术保障,实时、稳定、到达率高!

阿里云通信官网: https://dayu.aliyun.com

阿里云通信API文档: https://api.alidayu.com/doc2/apiList.htm

环境要求

安装

composer require vicens/alidayu

使用

设置配置

use Vicens\Alidayu\Alidayu;
Alidayu::setConfig([
   'appKey' => '23356838',
   'appSecret' => '254fee5fbabe2e01be04581d855c9af3',
   // 使用HTTPs
   'secure' => false,
   // 沙盒环境
   'sandbox' => false
]);

调用API

use Vicens\Alidayu\Alidayu;
// 发送短信通知
$sms = Alidayu::sms($recNum, $smsTemplateCode, $smsFreeSignName, $smsParam, $extend);
// 发送请求并返回响应
$response = $sms->send();

if ($response->success()) {
    // 接口返回成功
    print_r($response->getData());
} else {
    // 接口返回错误
    echo $response->getError();
}

已支持的接口列表