2017 © Pedro Peláez
 

yii2-extension yii2-aliyun-mns

阿里云短信推送,yii2-aliyun-mns

image

xiaochengfu/yii2-aliyun-mns

阿里云短信推送,yii2-aliyun-mns

  • Wednesday, June 7, 2017
  • by xiaochengfu
  • Repository
  • 1 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

阿里云、云片短信推送,yii2-mns

阿里云、云片短信推送, (*1)

Installation

The preferred way to install this extension is through composer., (*2)

Either run, (*3)

composer require xiaochengfu/yii2-mns "v1.0.1"

or add, (*4)

"xiaochengfu/yii2-mns": "*"

to the require section of your composer.json file., (*5)

Usage

1.在主配置文件中增加components, (*6)

'components' => [
      'mns'=>[
                 'class'=> 'xiaochengfu\mns\Module',
                 'config'=>[
                     'aliyun'=>[
                         'active'=>true, //true位开启,false为关闭
                         'accessId' => 'xxxx',
                         'accessKey' => 'xxxxxxxxx',
                         'endpoint' => 'http://xxxx.mns.cn-hangzhou.aliyuncs.com/',
                         'topicName' => 'xxx',
                         'smsSignName' => 'xxxx',
                     ],
                     'yunpian' => [
                         'active'=>false,
                         'apikey' => 'xxxxxx', // 请替换成您的apikey
                     ]
                 ]

             ],
]

2.在程序中使用:, (*7)

当使用云片时:, (*8)

$smsParams = '具体的消息内容';

当使用阿里云时:, (*9)

$smsParams = [
    'code'=>'xxx',
    'product'=>'xxx'
];

单条发送:, (*10)

Yii::$app->mns->send('186********',$smsParams,MnsComponent::YZM);

//批量发送, (*11)

$mobile = ['phone1','phone2','phone3'];
$result = Yii::$app->mns->batchSend($mobile,$smsParams,MnsComponent::YZM);

$smsParams与MnsComponent::YZM的类型要一致,这里可以根据自己的模板id自行定义规则!, (*12)

The Versions

07/06 2017

dev-master

9999999-dev

阿里云短信推送,yii2-aliyun-mns

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 yii2-aliyun-mns aliyun-mns