Download the PHP package protobrick/mtproto-client without Composer
On this page you can find all versions of the php package protobrick/mtproto-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download protobrick/mtproto-client
More information about protobrick/mtproto-client
Files in protobrick/mtproto-client
Package mtproto-client
Short Description Modern async pure PHP client library for Telegram MTProto API
License MIT
Homepage https://github.com/Proto-Brick/php-mtproto-client
Rated 5.00 based on 1 reviews
Informations about the package mtproto-client
Proto Brick is just starting its journey. Your stars ⭐️ are crucial for the project's visibility!
Proto Brick
Modern async pure PHP client library for Telegram MTProto. Build userbots with direct API access — no TDLib dependencies.
[!NOTE] 🚧 Work in Progress: This library is currently under active development. Features are being added rapidly, and breaking changes may occur before the v1.0 release.
🚀Features
- Full Async: Built on top of AMPHP and Revolt for high-performance non-blocking I/O.
- Pure PHP Implementation: No requirement for the official
tdlibbinary extension. Works anywhere PHP runs. - Strictly Typed: 100% of the API is auto-generated from the official TL-Schema.
- Direct API Access: 1:1 mapping of Telegram API methods (e.g.,
$client->messages->sendMessage). - Smart Peer Management: Automatically handles
access_hashand resolves@usernamesorIDsvia local cache. - Advanced Logging: Native colorized console output with channel filtering, fully compatible with PSR-3
📋Requirements
- PHP 8.2+ (64-bit)
- Required Extensions:
ext-zlib,ext-json - Highly Recommended Extensions:
ext-gmp(Speeds up crypto/auth operations).ext-openssl(Speeds up crypto operations).ext-uv(Better event loop performance).
Installation
Authentication
Interactive Login (CLI)
Run once to log in. It prompts for credentials (phone, code, 2FA) and saves the session locally.
Custom Flow
If you need to handle login programmatically (e.g., from database, API, or custom input), pass callables
Calling API Methods
Use this for simple scripts (e.g., cron jobs) where you need to perform an action and exit.
Handling Updates
Use the Event Loop to build bots or tools that react to events in real-time.
Async vs Sync Execution
The client provides generated *Async methods for every API call.
1. Synchronous & Concurrent
Use synchronous calls for simple logic, and concurrent execution for performance.
2. Fire & Forget
Use ignore() for tasks where you don't care about the result or errors.
[!WARNING]
ignore()pushes the task to the Event Loop.
- Short Scripts: If your script ends immediately (reaches the end of the file), the Event Loop stops, and the request will not be sent.
- Daemons/Bots: This works perfectly inside
$client->start()or long-running processes, as the loop keeps turning.
Advanced Configuration
You can customize the connection settings via the Settings object:
Architecture
Generated Code
The core of this library is generated automatically:
- *`src/Generated/Api/.php
**: Methods grouped by namespace (messages,users`, etc.). - `src/Generated/Types//*.php
**: DTOs for every TL object (InputPeer,Message,User`, etc.).
API Layer Updates (Schema)
You can regenerate the library API for a newer or older API layer yourself, without waiting for a release.
- Download the new
.jsonschema file (e.g., from here). - Ensure the filename contains the version number (e.g.,
TL_telegram_v220.json). - Place the file in the
schema/directory (you can keep the old ones; the builder automatically picks the highest version). - Run the builder:
Downgrading: To build using a specific schema file, pass the path as an argument:
⚠️ Disclaimer
This library is intended for personal automation and educational use. We are not responsible for any account limitations caused by misuse, spamming, or violating Telegram's Terms of Service. Please automate responsibly.
💬 Community & Support
ProtoBrick is a young library, and we are building a community of developers interested in MTProto.
- Telegram Chat: Join the Discussion — Ask questions, suggest features, or share your projects.
- GitHub Issues: Found a bug? Open an issue here.
- Stars: If you find this library useful, please give it a star ⭐️! It helps us grow and keeps the updates coming.
Contributions (PRs) are always welcome!
License
MIT License. See LICENSE for details.
All versions of mtproto-client with dependencies
ext-json Version *
ext-zlib Version *
phpseclib/phpseclib Version ^3.0
amphp/sync Version ^2.3
amphp/socket Version ^2.3
revolt/event-loop Version ^1.0
psr/log Version ^3.0