websightnl/yii2-sms

SMS Component for Yii2

Installs: 27

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 6

Type:yii2-extension

0.2.4 2016-08-24 15:30 UTC

This package is auto-updated.

Last update: 2024-10-20 23:01:00 UTC


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');