PHP code example of manzadey / stream-telecom

1. Go to this page and download the library: Download manzadey/stream-telecom 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/ */

    

manzadey / stream-telecom example snippets


use Manzadey\StreamTelecom\StreamTelecom;

$st = new StreamTelecom('name', 'login', 'password');

echo $st->balance();

echo $st->tariffs();

echo $st->tariffs()->hlr();
echo $st->tariffs()->email();
echo $st->tariffs()->messenger();

$st->statistic()->start('02.02.2020 10:00')->end('03.03.2020 10:00')->get();

$st->statistic()->start('02.02.2020 10:00')->end('03.03.2020 10:00')->detail()->get();

$st->statistic()
->start('02.02.2020 10:00')
->end('03.03.2020 10:00')
->detail()
->state('not_deliver')
->phone(79111234567)
->cBase()
->subStat()
->typeLoad(1)
->get();

$st->hlr()->phone(7912345678)->get(); // 123456789101213

$st->hlr()->status(123456789101213);

$st->sms()->send()
->text('text message')
->to(['+79123456789', 79123456789, '+7(912)-345-67-89'])
->get();

$phones_array  = [
    '+79123456789',
    79123456789,
    '+7(912)-345-67-89',
];

$phones_array2 = [79987654321];

$st->sms()->send()
->validity(10)
->package(static function ($s) use ($phones_array) {
    return $s->text('test')->to($phones_array);
})
->package(static function ($s) use ($phones_array2) {
    return $s->text('test2')->to($phones_array2);
})
->get();

$st->sms()->status(14561456165332)->get();

$st->sms()->incoming()->start('29.01.2020 13:00')->end('30.01.2020 13:00')->get();

$st->setup()->email('password_from_pa');

$st->email()->list()->method('get')
->listId(123)
->get();

$st->email()->list()->method('add')
->name('TestBase')
->abuseEmail('[email protected]')
->abuseName('OwnerName')
->company('CompanyName')
->address('MyAddress')
->city('Spb')
->zip(190000)
->county('Russia')
->url('mysite.com')
->phone(79999999999)
->get();

$st->email()->list()->method('update')
->listId(123)
->name('TestBase')
->abuseEmail('[email protected]')
->abuseName('OwnerName')
->company('CompanyName')
->address('MyAddress')
->city('Spb')
->zip(190000)
->county('Russia')
->url('mysite.com')
->phone(79999999999)
->get();

$st->email()->list()->method('delete')
->listId(123)
->get();

$st->email()->list()->method('get_members')
->listId(123)
->state('active')
->limit(1)
->get();

$st->email()->list()->method('upload')
->listId(123)
->file('http://www.mysite.ru/files/file.csv')
->type('csv')
->get();

$st->email()->list()->method('add_member')
->listId(123)
->email('[email protected]')
->merge(1, 'Иван')
->merge(2, 'Иванов')
->merge(3, '1985-11-23')
->gender('m')
->get();

$st->email()->list()->method('update_member')
->memberId(123)
->merge(1, 'Иван')
->merge(2, 'Иванов')
->merge(3, '1985-11-23')
->gender('m')
->get();

$st->email()->list()->method('delete_member')
->memberId(123)
->get();

$st->email()->list()->method('unsubscribe_member')
->memberId(123)
->listId(123)
->email('[email protected]')
->reason('Отписка по заявке')
->get();

$st->setup()->viber('sourceAddressIM');

$st->viber()
->text('Привет вайбер')
->to(79211234567)
->validity(7200)
->get();

$st->viber()
->image('https://my.site.com/images/image.jpg')
->to(79211234567)
->validity(7200)
->get();

$st->viber()
->text('Привет вайбер')
->image('https://my.site.com/images/image.jpg')
->buttonText('Нажми на кнопку ')
->buttonUrl('stream-telecom.ru')
->to(79211234567)
->validity(7200)
->get();

$st->viber()
->text('Привет вайбер')
->cascade('Текст резервного сообщения по sms')
->image('https://my.site.com/images/image.jpg')
->buttonText('Нажми на кнопку ')
->buttonUrl('stream-telecom.ru')
->to(79211234567)
->validity(7200)
->get();

$st->viber()
->package(static function ($v) {
    return $v->text('Привет вайбер')->to(79211234567)->validity(7200);
})
->package(static function ($v) {
    return $v->image('https://my.site.com/images/image.jpg')->to(79211234567)->validity(7200);
})
->package(static function ($v) {
    return $v->text('Привет вайбер')->image('https://my.site.com/images/image.jpg')->buttonText('Нажми на кнопку ')->buttonUrl('stream-telecom.ru')->to(79211234567)->validity(7200);
})
->package(static function ($v) {
    return $v->text('Привет вайбер')->sms('Текст резервного сообщения по sms')->image('https://my.site.com/images/image.jpg')->buttonText('Нажми на кнопку ')->buttonUrl('stream-telecom.ru')->to(79211234567)->validity(7200);
})
->get();

$viber_status = $st->viber()->messageId(12345)->get();

// Тип сообщения
$viber_status->getStateMessage();

// Статус сообщения
$viber_status->getStateMessage();

// Причина, по которой сообщение не было доставлено абоненту
$viber_status->getStateErrorMessage();

// Время получения статуса
$viber_status->getStateTime();

// Стоимость
$viber_status->getPrice();

$st->setup()->vk('service');

$st->vk()
->template(8, ['username' => 'Alexey', 'balance' => '1000000'])
->ttl(60)
->to(79999999998)
->get();

$st->vk()->package(static function ($c) {
    return $c->template(8, ['username' => 'Alexey', 'balance' => '1000000'])->to(7911102461)->ttl(1);
})->package(static function ($c) {
    return $c->template(8, ['username' => 'Alexey', 'balance' => '1000000'])->to(7911102461)->ttl(1);
})->get();