dpodium/yii2-twilio

Yii2 twilio is a wrapper for the Twilio PHP library. Allow yii2 application to use twilio services.

Installs: 6 179

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 6

Forks: 0

Open Issues: 1

Type:yii2-extension

1.5 2017-08-10 00:56 UTC

This package is auto-updated.

Last update: 2024-10-12 19:49:45 UTC


README

Twilio yii2 wrapper. Enable twilio services in yii2 application.

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require dpodium/yii2-twilio "*"

or add

"dpodium/yii2-twilio": "*"

to the require section of your composer.json file.

Component Setup

Once the extension is installed, simply modify your application configuration as follows:

return [
    'components' => [
    ...
        'twilio' => [
                   'class' => dpodium\yii2\Twilio\TwilioManager::class,
                   'config' => [
                                   'sid' => API_SID, //from twilio
                                   'token' => API_TOKEN, //from twilio
                               ],
                   //leave blank if not applicable
                   'proxy' => [
                                   'host' => HOST,
                                   'port' => PORT,
                               ],
               ],
        ...
    ],
    ...
];

Usage

Sending message
Yii::$app->twilio->sendSms(TO, FROM, 'Test Message');

Make call
Yii::$app->twilio->call(TO, FROM);

Lookup phone info
Yii::$app->twilio->lookup(PHONENO);

Generating TwiML
Yii::$app->twilio->generateTwiml();