2amigos/yii2-nexmo-library

此软件包已被废弃,不再维护。未建议替代软件包。

Yii框架的Nexmo库

安装次数: 4,556

依赖项: 0

建议者: 0

安全性: 0

星标: 2

关注者: 18

分支: 8

开放问题: 1

类型:yii2-extension

1.0.1 2017-06-09 08:41 UTC

This package is auto-updated.

Last update: 2023-08-16 02:20:26 UTC


README

Latest Version Software License Build Status Coverage Status Quality Score Total Downloads

Nexmo库允许Yii程序员使用由移动消息提供商Nexmo提供的RESTful API。

Nexmo是一个基于云的SMS API,允许您以批发价格发送和接收大量消息。

安装

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

运行以下命令之一

$ composer require 2amigos/yii2-nexmo-library:~1.0

或将其添加到composer.json文件的require部分。

"2amigos/yii2-nexmo-library": "~1.0"

使用

首先,您需要创建您的[Nexmo帐户](Nexmo API凭证)并获取您的API_KEY和API_SECRET。

// to send an sms message
$sms = new \dosamigos\nexmo\Sms(['key' => 'API_KEY', 'secret' => 'API_SECRET', 'from' => 'SENDERID']);

// lets call the API to get a json response
$sms->format = 'json';

// send a message with an optional parameter (see Nexmo doc for more optional parameters)
$response = $sms->sendText('RECIPIENTSNUMBER', 'Hello World!', ['clientRef' => 'YOURCLIENTREF']);

// if a response expects a JSON object, it will return as an array, if format was a XML, it will return an object.
echo $response['message-count']; // the number of parts the message was split into

测试

$ ./vendor/bin/phpunit

贡献

请参阅CONTRIBUTING以获取详细信息。

致谢

许可

BSD许可(BSD)。有关更多信息,请参阅许可文件

687474703a2f2f7777772e67726176617461722e636f6d2f6176617461722f35353336333339346437323934356666376564333132353536656330343165302e706e67
web开发从未如此有趣
www.2amigos.us