tugmaks/sms-sender

SMS sender library

dev-master 2014-12-19 14:19 UTC

This package is auto-updated.

Last update: 2024-05-24 19:59:56 UTC


README

SMS sender library

Installation

The preferred way to install this extension is through composer.

Add

"tugmaks/sms-sender": "dev-master"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by :

use tugmaks/SMS/gates/ItakazanGate;
$gate = new ItakazanGate([
    'login'=>'yourlogin',
    'password'=>'yourpassword',
    'mac'=>'yourmac',
]);

echo $gate->getBalance();

By default Itakazan gate use one url to access its api. You can get it via $gate->getGateUrl(). If this gate will use another url or mirrors you can redefine it like this:

use tugmaks/SMS/gates/ItakazanGate;
$gate = new ItakazanGate([
    'login'=>'yourlogin',
    'password'=>'yourpassword',
    'mac'=>'yourmac',
]);
$gate->setGateUrl = 'http://new-api-address.me';

Error handling. Each request to api will return its result or false if error occured. To get error respresentation you can use this code:

if(!$gate->someMethod()){
    //handle error here
    echo $gate->getError();
}

Methods.

  • $gate->getBalance() will return current balance (float) or false if error occured.
  • php $gate->getSignatures() return array of allowed signatures or false if error occured. Example : php [0=>'signat1',1=>'loremsignat'] .
  • php $gate->getPrices()
  • addSignature()
  • deleteSignature()
  • getArchive()
  • send()