dpodium / yii2-twilio
Yii2 twilio is a wrapper for the Twilio PHP library. Allow yii2 application to use twilio services.
1.5
2017-08-10 00:56 UTC
Requires
- twilio/sdk: ~5.0
- yiisoft/yii2: 2.0.*
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
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();