uguranyum/yii2-zadarma-sms

Zadarma Sms 扩展程序 for yii2

安装: 19

依赖项: 0

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 0

类型:扩展

1.0 2016-08-09 11:51 UTC

This package is not auto-updated.

Last update: 2024-09-15 00:33:43 UTC


README

Yii2 扩展程序,用于与 Zadarma API 一起工作。允许使用 API 方法。

Latest Stable Version Total Downloads

##要求

  • Yii2 PHP 框架
  • PHP >= 5.3.0
  • cURL

##通过 Composer 下载

composer require uguranyum/yii2-zadarma-sms

##如何使用

在使用控制器之前,请定义 Zadarma 类

use uguranyum\zadarma\Zadarma;

发送短信

$params = [
    'number' => 'YOUR PHONE NUMBER',
    'message' => 'PLEASE WRITE YOUR MESSAGE HERE',
];

$zadarma    = new Zadarma("ZADARMA API KEY", "ZADARMA API SECRET");
$answer     = $zadarma->call('/v1/sms/send/', $params, 'post');
$answerObject = json_decode($answer);
print_r($answerObject);

查看统计信息

$params = array(
    'start' => '2015-01-01 00:00:00',
    'end' => '2015-01-31 00:00:00',
    /*'sip' => 'YOURSIP',*/
    /*'cost_only' => true,*/
    /*'type' => 'toll'*/
);
$zadarma    = new \Zadarma_API\Client(KEY, SECRET);
$answer     = $zadarma->call('/v1/statistics/', $params);
$answerObject = json_decode($answer);