PHP code example of muaath5 / simple-bot-api

1. Go to this page and download the library: Download muaath5/simple-bot-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/ */

    

muaath5 / simple-bot-api example snippets


use SimpleBotAPI/TelegramBot;
use SimpleBotAPI/BotSettings;

$Bot = new TelegramBot('bot_token');

$Bot->SendMessage([
    'chat_id' => '@MuaathBots',
    'text' => 'This post was sent by the bot..'
]);

$my_channel_info = $Bot->getChat([
    'chat_id' => '@MuaathBots',
]);
echo "Your channel (@{$my_channel_info->username}) ID: {$my_channel_info->id}";