uguranyum/yii2-zadarma-sms

Zadarma Sms Extension for yii2

1.0 2016-08-09 11:51 UTC

This package is not auto-updated.

Last update: 2024-04-13 22:25:09 UTC


README

Yii2 extension for work with Zadarma API. Allows to work with API methods.

Latest Stable Version Total Downloads

##Requirements

  • Yii2 PHP Framework
  • PHP >= 5.3.0
  • cURL

##DOWNLOAD VIA COMPOSER

composer require uguranyum/yii2-zadarma-sms

##How to use

Before the using controller please define Zadarma class

use uguranyum\zadarma\Zadarma;

For sending Sms

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

For looking statics

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