PHP code example of poor-plebs / telegram-bot-sdk

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

    

poor-plebs / telegram-bot-sdk example snippets




declare(strict_types=1);

use PoorPlebs\TelegramBotSdk\TelegramBot\TelegramBotClient;
use Psr\SimpleCache\CacheInterface;

/** @var CacheInterface $cache */
$client = new TelegramBotClient(
    cache: $cache,
    token: '123456:YOUR_BOT_TOKEN',
    chatId: 123456789,
);

$client->sendMessage('Hello from SDK')->wait();
bash
docker compose build php