yii2-sms
, (*1)
This extension allows SMS sending via different SMS providers, (*2)
Installation:
The preferred way to install this extension is through composer., (*3)
Either run, (*4)
php composer.phar require --prefer-dist alexeevdv/yii2-sms "~1.0"
or add, (*5)
"alexeevdv/yii2-sms": "~1.0"
to the require section of your composer.json., (*6)
Configuration:
use alexeevdv\sms\provider\SmsRuProvider;
use alexeevdv\sms\Sms;
//...
'components' => [
'sms' => [
'class' => Sms::class,
'provider' => [
'class' => SmsRuProvider::class,
'apiId' => '123456789',
],
],
],
//...
Usage:
$result = Yii::$app->sms->send('1234567890', 'Hi there!');
Supported providers:
-
sms.ru, (*7)
Class: \alexeevdv\sms\provider\SmsRuProvider
Params:, (*8)
-
apiId
- Your api ID from sms.ru
-
smsc.ru, (*9)
Class: \alexeevdv\sms\provider\SmscRuProvider
Params:, (*10)
-
login
- Your login from smsc.ru
-
psw
- Your plain text or MD5 hashed password from smsc.ru