PHP code example of imsadhappy / laravel-kyivstar-api
1. Go to this page and download the library: Download imsadhappy/laravel-kyivstar-api 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/ */
imsadhappy / laravel-kyivstar-api example snippets
/**
* Відправити SMS
*
* @param string $to - номер отримувача
* @param string $text - повідомлення
* @returns string $id - ідентифікатор відправленого SMS
*/
app(KyivstarApi::class)->Sms()->send('+380670000202', 'message text');
/**
* Перевірити статус відправки SMS
*
* @param string $id - ідентифікатор відправленого SMS
* @returns string $status - accepted|delivered|seen
*/
app(KyivstarApi::class)->Sms()->status($id);
/**
* Відправити Viber повідомелння
*
* @param string $to - номер отримувача
* @param string $text - повідомлення
* @returns string $id - ідентифікатор відправленого Viber повідомелння
*/
app(KyivstarApi::class)->Viber()->transaction('+380670000202', 'message text');
/**
* Відправити Viber повідомелння з картинкою (і кнопкою)
*
* @param string $to - номер отримувача
* @param string $text - повідомлення
* @param int|null $messageTtlSec
* @param string|null $img - посилання на зображення
* @param string|null $caption - текст кнопки (необов'язково)
* @param string|null $action - посилання кнопки (необов'язково)
* @returns string $id - ідентифікатор відправленого Viber повідомелння
*/
app(KyivstarApi::class)->Viber()->promotion('+380670000202',
'message text',
null /* ttl, default 1209600 */,
'https://example.com/image.jpg',
'Click Me',
'https://example.com/');
/**
* Перевірити статус відправки Viber повідомелння
*
* @param string $id - ідентифікатор відправленого Viber повідомелння
* @returns string $status - accepted|delivered|seen
*/
app(KyivstarApi::class)->Viber()->status($id);
app(KyivstarApi::class)->Sms('Foo');
app(KyivstarApi::class)->Viber('Bar');
try {
app(KyivstarApi::class)-> ...
} catch (\Exception $e) {
...
}