MadelineProto is an asynchronous PHP library that provides a programmatic interface for interacting with the Telegram API using the MTProto protocol, the same protocol used by official Telegram clients. It functions as both a Telegram bot SDK and a userbot automation library, enabling PHP applications to connect to Telegram as either a bot account or a regular user account, sending and receiving messages, media, and other data directly without relying on the Bot API intermediary.
The library is built on an event-driven architecture with Amp v3 fiber-based concurrency, allowing for non-blocking, concurrent operations within a single-threaded event loop. It includes a modular plugin system for processing Telegram updates with attribute-based filters and concurrent handler execution, and supports batch method containerization for efficient processing of multiple API calls. MadelineProto also provides a VoIP call management engine for initiating, accepting, and managing Telegram voice calls with audio streaming and recording capabilities, as well as multi-protocol proxy routing through MTProxy, SOCKS5, or HTTP proxies.
Beyond its core messaging and event handling capabilities, MadelineProto offers comprehensive file transfer and media management, supporting uploads, downloads, and streaming of files up to 4GB with progress tracking and parallel transfers. It includes an async ORM for session persistence, Prometheus metrics endpoints for monitoring, and supports multiple database backends including MariaDB, PostgreSQL, and Redis for persistent storage. The library also provides tools for authentication via phone number, bot token, or QR code, and includes features for managing secret chats, forum topics, and chat join requests.