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

1.3 2017-05-08 05:04 UTC

This package is auto-updated.

Last update: 2024-11-12 19:21:25 UTC


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