PHP code example of steadfast / telegram-bot-api

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

    

steadfast / telegram-bot-api example snippets

 php
use TelegramBot\Api\BotApi;

$bot = new BotApi($bot_api_token);

$bot->sendMessage($chat_id, $message_text);
 php
use TelegramBot\Api\Client;

$bot = new Client($bot_api_token);

$bot->on(function ($update) {
    echo $update->getUpdateId();
});