Search by

tueen / telegram

nabeghe

The Royal Telegram Bot SDK for Modern PHP โ€” declarative, stateful, and resilient.

Package info

github.com/tueen/telegram

pkg:composer/tueen/telegram

Statistics

Installs: 14

Dependents: 0

Suggesters: 0

Stars: 4

Open Issues: 0

v1.0.0-alpha.5 2026-10-11 20:24 UTC

This package is auto-updated.

Last update: 2026-11-05 01:53:52 UTC


README

Tueen Telegram Logo

Tueen Telegram ๐Ÿ‘‘

The Royal Telegram Bot SDK for Modern PHP
Part of the Tueen ecosystem โ€” "The Queen of Telegram"

PHP Version Telegram Bot API CI Status Documentation LLM Hub License: MIT

โšก Highlights

  • ๐Ÿ‘‘ Complete Bot API Coverage โ€” Strictly-typed methods, models, and enums for all Telegram features.
  • ๐Ÿ’Ž Modern PHP 8.4+ Architecture โ€” Built with property hooks, asymmetric visibility, and zero legacy baggage.
  • ๐Ÿงญ Expressive Routing โ€” Commands, callback queries, regex matchers, and PHP 8 attribute controllers.
  • โŒจ๏ธ Fluent Keyboards & Safe Formatting โ€” Intuitive Inline/Reply builders and entity-safe HTML/MarkdownV2 styling.
  • ๐Ÿ’ฌ Conversational Flows & Navigation โ€” Multi-step state machines, hierarchical screen stacks, and zero-flicker UI transitions.
  • ๐Ÿ”„ Production Webhook & Polling โ€” Secret token validation and persistent worker support (FrankenPHP, Swoole, RoadRunner).
  • ๐Ÿš€ Zero-Config App & Web Dashboard โ€” Instant bot launcher with a CLI toolkit and an embedded management dashboard.
  • ๐Ÿ”Œ Resilient HTTP Pipeline โ€” Persistent connection pooling, automatic rate-limit backoff, and PSR-3 logging.
  • ๐Ÿ›ก๏ธ Dual Error Modes โ€” Choose between traditional exceptions or typed error objects with universal status checks.
  • ๐Ÿงช In-Memory Testing โ€” First-class testing fakes with expressive assertions and zero HTTP overhead.

๐Ÿ“ฆ Requirements & Installation

  • PHP 8.4 or higher (fully compatible with PHP 8.5+)
  • Composer 2.x
  • Extensions: json, curl or stream wrappers, mbstring
composer require tueen/telegram

๐Ÿš€ Quickstart

Build an interactive bot with command routing, inline buttons, and safe HTML formatting:

<?php

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;

require __DIR__ . '/vendor/autoload.php';

$bot = new Telegram('YOUR_BOT_TOKEN');

// Handle /start command with auto-wired User parameter
$bot->onCommand('start', function (User $user, Telegram $bot) {
    $keyboard = InlineKeyboard::make()
        ->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();

๐Ÿ’ก Looking for zero-config single-file bootstrapping and the embedded Web Dashboard? Check out the Zero-Config App & Web Dashboard Guide.

๐Ÿ“– Documentation

Complete guides, real-world examples, configuration options, and API catalogs are available in our official documentation:

๐Ÿ‘‰ https://tueen.github.io/telegram/

For AI coding assistants (Cursor, Claude, ChatGPT), machine-readable context and offline skill packages are available at the AI & LLM Context Hub.

๐Ÿ“œ License

tueen/telegram is open-sourced software licensed under the MIT License.