dpodium / yii2-nexmo
Yii2 nexmo is a wrapper for the Nexmo PHP library. Allow yii2 application to use nexmo services.
Installs: 283
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 5
Forks: 2
Open Issues: 1
Type:yii2-extension
Requires
- php: >=5.4
- php-http/client-implementation: ^1.0
- php-http/guzzle6-adapter: ^1.0
- yiisoft/yii2: 2.0.*
- zendframework/zend-diactoros: ^1.3
Requires (Dev)
- php-http/mock-client: ^0.3.0
- phpunit/phpunit: ^5.3
README
Nexmo yii2 wrapper. Enable nexmo services in yii2 application.
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require dpodium/yii2-nexmo "*"
or add
"dpodium/yii2-nexmo": "*"
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' => [ ... 'nexmo' => [ 'class' => dpodium\yii2\Nexmo\NexmoManager::class, 'config' => [ 'api.key' => API_KEY, //from nexmo 'api.secret' => API_SECRET, //from nexmo ], //leave blank if not applicable 'proxy' => [ 'host' => HOST, 'port' => PORT, ], ], ... ], ... ];
Usage
Sending message
Yii::$app->nexmo->sendSms(TO, FROM, 'Test Nexmo Message');
Receiving A Message
Yii::$app->nexmo->receiveMessage();
Fetching A Message
Yii::$app->nexmo->fetchMessage(MESSAGE_ID);
Starting a Verification
Yii::$app->nexmo->initVerification(NUMBER, BRAND);
Controlling a Verification
Trigger
Yii::$app->nexmo->triggerVerification(REQUEST_ID);
Cancel
Yii::$app->nexmo->cancelVerification(REQUEST_ID);
Checking A Verification
Yii::$app->nexmo->checkVerification(REQUEST_ID, CODE);
Searching For A Verification
Yii::$app->nexmo->searchVerification(REQUEST_ID);