PHP code example of tueen / telegram

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

    

tueen / telegram example snippets




declare(strict_types=1);

use Tueen\Telegram\Telegram;
use Tueen\Telegram\Types\User;
use Tueen\Telegram\Types\Update;
use Tueen\Telegram\Keyboards\InlineKeyboard;
use Tueen\Telegram\Formatting\Text;

 ->row()
            ->callback('✨ Explore', 'action:explore')
            ->url('📚 Documentation', 'https://tueen.github.io/telegram/')
        ->build();

    $bot->reply(
        Text::html()
            ->bold("Welcome, {$user->firstName}! 👋")->line()
            ->plain("Ready to build modern Telegram bots with PHP 8.4+?"),
        replyMarkup: $keyboard
    );
});

// Handle callback query button tap
$bot->onCallbackQuery('action:explore', function (Update $update, Telegram $bot) {
    $bot->answerCallbackQuery($update->callbackQuery->id);
    $bot->reply('Explore full guides and examples at https://tueen.github.io/telegram/');
});

// Start long-polling (or configure WebhookMode for production)
$bot->usePollingMode();
$bot->run();