PHP code example of kavalar / telegram_bot
1. Go to this page and download the library: Download kavalar/telegram_bot 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/ */
kavalar / telegram_bot example snippets
$bot = new TelegramBotService($token);
$result = $bot->sendMessageTo($chat_id, $message);
[
'template_name' => "Hello ~name~"
];
[
'name' => 'Jhon'
];
$bot = new TelegramBotService($token);
$templates = [
'example' => "Hello ~name~"
];
$attributes = [
'name' => 'Jhon'
];
$templateProcessor = new BotNotificationTemplateProcessor($templates);
$message = $templateProcessor->renderTemplate('example', $attributes);
$result = $bot->sendMessageTo($chat_id, $message);