dpodium/yii2-nexmo

Yii2 nexmo 是 Nexmo PHP 库的包装器。允许 yii2 应用程序使用 Nexmo 服务。

安装: 283

依赖: 0

建议者: 0

安全: 0

星标: 1

关注者: 5

分支: 2

开放问题: 1

类型:yii2-extension

1.3 2017-05-08 05:04 UTC

This package is auto-updated.

Last update: 2024-09-12 18:55:18 UTC


README

Nexmo yii2 包装器。在 yii2 应用程序中启用 Nexmo 服务。

安装

安装此扩展的首选方法是通过 composer

运行以下命令之一

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

或者在您的 composer.json 文件的 require 部分添加

"dpodium/yii2-nexmo": "*"

组件设置

扩展安装完成后,只需修改您的应用程序配置如下

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,
                               ],
               ],
        ...
    ],
    ...
];

使用方法

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