PHP code example of soroush-app / bot-php-sdk
1. Go to this page and download the library: Download soroush-app/bot-php-sdk 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/ */
soroush-app / bot-php-sdk example snippets
$bot_token = 'your-bot-token';
$bot = new Soroush\Client($bot_token);
try {
$to = 'bot user id';
list($error, $success) = $bot->sendText($to, 'Sample text');
if($success) {
echo 'Message sent successfully' . PHP_EOL;
} else {
echo 'Fail : ' . $error. PHP_EOL;
}
} catch (Exception $e) {
die($e->getMessage());
}
bash
git clone https://github.com/soroush-app/bot-php-sdk
cd bot-php-sdk
composer install