fighcell / yii2-sms
dev-master
2022-09-23 00:17 UTC
Requires
- php: >=7.0
- yiisoft/yii2: ~2.0.45
This package is auto-updated.
Last update: 2024-09-23 04:41:45 UTC
README
这是一个用于发送短信的组件,模仿了yii mailer组件的行为
安装
通过composer.json
composer require fighcell/yii2-sms
用法
将组件添加到main.php中。
[
'components' => [
'sms' => [
'class' => \fighcell\sms\providers\sendsmsro\SendSmsRo::class,
'viewPath' => '@common/sms',
'messageConfig' => [
'class' => \fighcell\sms\providers\sendsmsro\Message::class,
'from' => '0040766123456', // From number to send from
],
// send all sms to a file by default.
'useFileTransport' => true, // false for real sending
'username' => '{USERNAME}',
'password' => '{PASSWORD}',
],
]
];
用法如下
Yii::$app->sms->compose()
->setTo('+40766123456')
->setMessage("Hey Receiver this is a message sent with SendSms.ro!\n\nThanks!Sender")
->send();
这是使用此yii2-extension制作的
https://yiiframework.cn/extension/wadeshuler/yii2-sms
2022-02-08 - 此扩展已被从Github移除,因此我们在base文件夹下添加了代码
更多详情请点击链接
扩展
只需将您的实现添加到providers文件夹中的一个新文件夹中。确保您扩展了AbstractBaseMessage和AbstractSms类。