gud3 / yii2-sms
消息发送者。该包包括对服务 turbosms 的发送功能。
1.0.0
2017-04-29 03:11 UTC
Requires
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2024-09-26 06:08:30 UTC
README
消息发送者。该包包括对服务 TurboSMS,SmsAPI 的发送功能。
安装
安装此扩展的首选方式是通过 Composer。
运行以下命令
php composer.phar require --prefer-dist gud3/yii2-sms "*"
或者在您的 composer.json
文件的 require 部分添加
"gud3/yii2-sms": "*"
以下内容
使用方法
要使用此扩展,只需在您的应用程序配置中添加以下代码
默认的 turbo sms 发送者名称为 'Msg'
return [ //.... 'components' => [ 'sms' => [ 'class' => 'gud3\sms\Client', 'sender' => 'Display name', 'service' => [ 'class' => 'gud3\sms\Services\SmsApi', // or TurboSms 'login' => '***', 'password' => '***', ], ], ], ];
然后您可以按照以下方式在队列中发送短信
Yii::$app->sms->send('+**********', 'This is text of test message'); Yii::$app->sms->send(['+**********', '+**********'], 'This is text of test message');