websightnl / yii2-sms
SMS Component for Yii2
Installs: 27
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 6
Type:yii2-extension
Requires
- twilio/sdk: ^5.0
- yiisoft/yii2: *
README
Note: Only using Twilio at the moment.
Setup
// app/config/main.php
return [
...
'components' => [
...
'sms' => [
'class' => 'websightnl\yii2sms\Twilio',
'sid' => '',
'token' => '',
'number' => '',
]
...
]
...
];
Usage
class User extends AR implements RecipientInterface {
...
public function getMobileNumber() {
return $this->profile->mobile_number;
}
...
}
$user = User::findByPk(1);
Yii::$app->sms->send($user, 'Hi');
// or
Yii::$app->sms->send('+612345678910', 'Hi');