2amigos / yii2-nexmo-library
此软件包已被废弃,不再维护。未建议替代软件包。
Yii框架的Nexmo库
1.0.1
2017-06-09 08:41 UTC
Requires
- php: >=5.5
- guzzlehttp/guzzle: ^6.0
- yiisoft/yii2: ^2.0
Requires (Dev)
- phpunit/phpunit: ~4.0
This package is auto-updated.
Last update: 2023-08-16 02:20:26 UTC
README
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)。有关更多信息,请参阅许可文件。
web开发从未如此有趣
www.2amigos.us