Skip to content
maule edited this page Aug 17, 2026 · 3 revisions

TGbotPHP Wiki

Welcome to the TGbotPHP documentation wiki. This is your comprehensive guide to building Telegram bots with TGbotPHP 2.0.

Quick Links

What is TGbotPHP?

TGbotPHP is a professional, production-ready Telegram Bot Framework for PHP 8.2+. It implements the complete Telegram Bot API with modern PHP practices, security-first design, and comprehensive documentation.

Key Characteristics

  • Complete API Coverage - 120+ Telegram Bot API methods fully implemented
  • Professional Architecture - PSR-4 autoloading, trait-based composition, middleware pipeline
  • Security First - HTTPS enforcement, token validation, rate limiting, session management
  • Modern PHP - PHP 8.2-8.4 with strict types and latest language features
  • Zero Dependencies - Production code has no external dependencies
  • Production Ready - Docker support, CI/CD pipelines, comprehensive testing
  • Extensible - Plugin system, middleware hooks, event listeners
  • Well Documented - 11 professional guides plus wiki

Framework Components

Core Framework

  • Bot - Main orchestrator class
  • ApiClient - Composes 120+ API methods through traits
  • Router - Command and callback routing
  • MiddlewarePipeline - Request processing pipeline
  • EventDispatcher - Lifecycle hooks and events

Security & Features

  • WebhookValidator - Secure webhook validation
  • RateLimiter - Request rate limiting
  • SessionManager - User session management
  • ArrayCache - In-memory caching with TTL
  • PluginManager - Plugin system for extensibility

Developer Tools

  • BotBuilder - Fluent configuration pattern
  • CLI Tool - Webhook and bot management
  • Keyboard Helpers - Easy button creation
  • MessageParser - Entity extraction and parsing
  • Logger - Comprehensive logging system

Version Information

Current Version: 2.0

  • Complete rewrite for PHP 8.4+
  • 120+ API methods implemented
  • Enterprise-grade security
  • Production-ready deployment
  • Comprehensive documentation

View Changelog

Getting Help

  • Documentation - Browse this wiki for detailed guides
  • Bug Reports - GitHub Issues
  • Questions - Use GitHub Discussions
  • Security - See Security Policy

Requirements

  • PHP 8.2 or higher (8.4+ recommended)
  • cURL extension enabled
  • Network access to Telegram Bot API
  • Composer for dependency management

Quick Start

<?php
require_once __DIR__ . '/vendor/autoload.php';

use TGbotPHP\Utilities\BotBuilder;

$bot = (new BotBuilder('YOUR_BOT_TOKEN'))
    ->addCommand('start', function($bot, $message) {
        $bot->sendMessage(
            chatId: $message['chat']['id'],
            text: 'Welcome to TGbotPHP!'
        );
    })
    ->build();

$bot->handle();

Project Stats

  • Lines of Code: 8,000+
  • API Methods: 120+
  • Trait Modules: 13
  • Test Coverage: Comprehensive
  • Documentation: Complete
  • PSR Standards: PSR-1, PSR-2, PSR-4, PSR-12
  • License: MIT

Repository

Author

LightYagami28 (ceo@retechrevive.it)


Ready to get started? Begin with the Getting Started guide or explore specific topics in the menu above.

Clone this wiki locally