PHP code example of tauweb / simple-telegram-bot-api

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

    

tauweb / simple-telegram-bot-api example snippets


composer 

$bot = new Bot('Your Bot Token');

$bot->sendMessage([
  'chat_id' => 11111,
  'text' => 'Hello, World',
]);

$bot->sendPhoto([
    'chat_id' => 11111,
    'photo' => 'http://url_to_image.jpg,
]);

$result = (new Bot('Your Bot Token'))->setWebHook(['url' => 'https://bot_webhook_url']);
var_dump($result);

(new Bot('Your Bot Token'))->getChatMember(['chat_id' => 111, 'user_id' => 222]);