PHP code example of matmper / php-telegram-sdk-bot

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

    

matmper / php-telegram-sdk-bot example snippets




use Matmper\TelegramBot;
use Matmper\Enum\ParseMode;

$botToken = '12345678:a1b2c3d4f5g6';
$chatID = '-100000000';

$telegram = new TelegramBot($botToken, $chatID);
$telegram->sendMessage('Hello world!');

// Send more optional options in the body of the request
$telegram->sendMessage('<b>Hello world!</b>', ['parse_mode' => ParseMode::HTML->value]);
bash
$ composer