https://packagist.org/packages/ender/yunpian-sms
Install
Via Composer
$ composer require ender/yunpian-sms
使用此sdk之前别忘了先在云片网络官网注册并申请相应的apikey
示例代码如下
发送短信
use Ender\YunPianSms\SMS\YunPianSms; $yunpianSms=new YunPianSms('xxxxxxxxxxxxxxxxxx'); $response=$yunpianSms->sendMsg('18xxxxxxx51','【云片网】您的验证码是1234');
获取当前账户余额等信息
use Ender\YunPianSms\SMS\YunPianUser; $yunpianSms=new YunPianUser('xxxxxxxxxxxxxxxx'); $response=$yunpianSms->getAccountInfo();
构造函数参数即为你的个人的apikey
根据云片网络官方接口文档的分类,也对应的封装了三个Class:
- YunPianUser
- YunPianSms
- YunPianTemplate
分别对应 账户,模板,短信三部分功能,基本覆盖了所有接口。