fighcell / yii2-sms
Component for sending 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-10-23 04:51:38 UTC
README
This is a component used to send sms, mimic the yii mailer component behaviour
Installation
via composer.json
composer require fighcell/yii2-sms
Usage
Add the component to your 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}',
],
]
];
Use as follow:
Yii::$app->sms->compose()
->setTo('+40766123456')
->setMessage("Hey Receiver this is a message sent with SendSms.ro!\n\nThanks!Sender")
->send();
This is made using this yii2-extension:
https://www.yiiframework.com/extension/wadeshuler/yii2-sms
02-08-2022 - This extension was removed from Github, so we added the code under the base folder
More details following the link
Extend
Just add your implementation into a new folder in the providers folder. Make sure you extend the AbstractBaseMessage and AbstractSms classes.