PHP code example of faytranevozter / zenziva-lib

1. Go to this page and download the library: Download faytranevozter/zenziva-lib library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

faytranevozter / zenziva-lib example snippets



use Faytranevozter\Zenziva\Sms;
// your code here ...

$sms = new Sms('faytranevozter', '123456');
// or
$sms = new Sms();
$sms->username('faytranevozter'); // chainable
$sms->password('123456'); // chainable
// send sms
$sms->send('089765432123', 'Helaw!'); // send(number, text, otp)

$sms = new Sms('faytranevozter', '123456', 'masking');
$sms->send('089765432123', 'Helaw! this is masking sms');
// or
$sms = new Sms('faytranevozter', '123456');
$sms->type('masking'); // chainable
// send sms
$sms->send('089765432123', 'Helaw! this is masking sms'); // send(number, text, otp)

$sms = new Sms('faytranevozter', '123456', 'sms_center');
$sms->subdomain('mysubdomain'); // chainable, [3456');
$sms->type('sms_center'); // chainable
$sms->subdomain('mysubdomain'); // chainable, [

$sms = new Sms('faytranevozter', '123456', 'masking');
$sms->send('089765432123', 'Helaw! this is masking sms', TRUE);
// or
$sms = new Sms('faytranevozter', '123456');
$sms->otp(TRUE); // chainable
// send sms
$sms->send('089765432123', 'Helaw! this is masking sms'); // send(number, text, otp)

$sms = new Sms();
$sms->username('faytranevozter')
    ->password('123456')
    ->type('masking')
    ->to('089765432123')
    ->message('Helaw!')
    ->send();

$sms = new Sms('faytranevozter', '123456');
$is_send = $sms->send('089765432123', 'Helaw! this is my sms');
if ($is_send) {
    echo "Sms sent!";
} else {
    echo "Uh-oh! Failed to send sms";
}

$sms = new Sms('faytranevozter', '123456');
$sms->send('089765432123', 'Helaw! this is my sms');
$sms->send('082341561273', 'Helaw! this is my second sms');

// get all response
print_r($sms->responses()); // return array of response

// get last response
print_r($sms->last_response()); // return last response


$sms = new Sms('faytranevozter', '123456');
$sms->send('089765432123', 'Helaw! this is my sms');
$sms->send('082341561273', 'Helaw! this is my second sms');

// get all error
print_r($sms->errors()); // return array of error

// get last error
print_r($sms->last_error()); // return last error


use Faytranevozter\Zenziva\Sms;

class Zenziva extends Sms {
    function __construct($params=array()) {
        parent::__construct(...$params);
    }
}

...

$this->load->library('Zenziva', ['faytranevozter', '123456', 'reguler']);
$this->zenziva->send('089765432123', 'Helaw! this is my sms');

...