2017 © Pedro Peláez
 

library yunpian-sms

A php SDK for yunpian(云片网络短信服务商) sms RESTFULL API

image

ender/yunpian-sms

A php SDK for yunpian(云片网络短信服务商) sms RESTFULL API

  • Wednesday, June 3, 2015
  • by argb
  • Repository
  • 2 Watchers
  • 24 Stars
  • 1,802 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 0 Open issues
  • 5 Versions
  • 6 % Grown

The README.md

云片网络短信发送PHP SDK

Note: 依赖guzzlehttp/guzzle 6,安装本此包时会默认安装此依赖,可能很多其他的第三方库依赖较低版本的guzzle,如guzzle 5, (*1)

这个SDK主要是对 云片网络 的HTTP短信发送相关API的PHP封装。, (*2)

云片网络是目前比较靠谱的短信发送提供商,速度和价格都不错,由于自己项目中用到,顺便打了个包共享给大家。, (*3)

Install

Via Composer, (*4)

``` bash $ composer require ender/yunpian-sms, (*5)


## Usage 如果单独使用别忘了引入composer生成的autoload.php文件 如果是laravel用户可以不用手动include 使用此sdk之前别忘了先在[云片网络官网](http://www.yunpian.com/)注册并申请相应的**apikey** 示例代码如下 #### 发送短信 ```php 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, (*6)

根据云片网络官方接口文档的分类,也对应的封装了三个Class: - YunPianUser - YunPianSms - YunPianTemplate, (*7)

分别对应 账户,模板,短信三部分功能,基本覆盖了所有接口。以下三个接口除外:, (*8)

  • 模板接口发短信(不推荐使用,新用户请用发短信) 这个接口官方不推荐,所以没有封装, (*9)

  • 推送状态报告 这是个推送接口,需要使用者提供url,故不作处理, (*10)

  • 推送回复短信 同样是个推送接口, (*11)

Note: 注意部分接口是高级接口,需要申请才能使用,具体可查阅官方文档, (*12)

各个接口与本SDK中方法的对应关系基本上可以从名字上猜出来,很直观,实在猜不出来进入到方法里面可以看到对应的官方http接口。, (*13)

返回值说明

所有接口返回php数组格式,最外层包括http status code 和云片网络的完整返回值两部分,以短信发送接口sendMsg返回值为例,格式如下: ``` php array ( 'status' => 200, 'data' => array ( 'code' => 0, 'msg' => 'OK', 'result' => array ( 'count' => 1, 'fee' => 1, 'sid' => 1956790935, ), ), ), (*14)

data部分就是官方api的完整返回值,此处把json字符串转成了数组形式。


## Change log

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

## Testing

``` bash
$ composer test

Contributing

Please see CONTRIBUTING for details., (*15)

Security

If you discover any security related issues, please email :author_email instead of using the issue tracker., (*16)

Credits

License

The MIT License (MIT). Please see License File for more information., (*17)

The Versions

03/06 2015

dev-master

9999999-dev https://www.bigfeettrip.com

A php SDK for yunpian(云片网络短信服务商) sms RESTFULL API

  Sources   Download

MIT

The Requires

 

The Development Requires

php sms duanxin

03/06 2015

v1.0.3

1.0.3.0 https://www.bigfeettrip.com

A php SDK for yunpian(云片网络短信服务商) sms RESTFULL API

  Sources   Download

MIT

The Requires

 

The Development Requires

php sms duanxin

02/06 2015

v1.0.2

1.0.2.0 https://www.bigfeettrip.com

A php SDK for yunpian(云片网络短信服务商) sms RESTFULL API

  Sources   Download

MIT

The Requires

 

The Development Requires

php sms duanxin

02/06 2015

v1.0.1

1.0.1.0 https://github.com/argb/yunpian-sms

A php SDK for yunpian(云片网络短信服务商) sms RESTFULL API

  Sources   Download

MIT

The Requires

 

The Development Requires

php sms duanxin

02/06 2015

v1.0.0

1.0.0.0 https://github.com/argb/yunpian-sms

A php package for yunpian sms RESTFULL API, and provided special support for Laravel5

  Sources   Download

MIT

The Requires

 

The Development Requires

league