danog /MadelineProto

Async PHP client API for the telegram MTProto protocol

★ 3,553⑂ 934👁 202⑃ 485● 1,358▤ 232◈ 38
PHPAGPL-3.0Created 2016-06-23docs.madelineproto.xyz
3,553
stars
934
forks
202
watchers
485
prs
1,358
issues
232
releases
38
discussions

README

MadelineProto, a PHP MTProto telegram client

Created by Daniil Gentili

StandWithUkraine 🇺🇦

Do join the official channel, @MadelineProto and the support groups!

Approved by Telegram!

 What's this?

This library can be used to easily interact with Telegram without the bot API, just like the official apps.

It can login with a phone number (MTProto API), or with a bot token (MTProto API, no bot API involved!).

It is now fully async!

 Getting started (now fully async!)

php
start();

$me = $MadelineProto-getSelf();

$MadelineProto-logger($me);

if (!$me['bot']) {
    $MadelineProto-messages-sendMessage(peer: '@stickeroptimizerbot', message: "/start");

    $MadelineProto-channels-joinChannel(channel: '@MadelineProto');

    try {
        $MadelineProto-messages-importChatInvite(hash: 'https://t.me/+Por5orOjwgccnt2w');
    } catch (\danog\MadelineProto\RPCErrorException $e) {
        $MadelineProto-logger($e);
    }

    // Video call @magicalcrazypony, the MadelineProto video webradio, playing a WebM video (works on webhosts, NO ffmpeg needed!)
    // See https://docs.madelineproto.xyz/docs/CALLS.html for group calls, livestreams, recording and more.
    $MadelineProto-requestCall('@magicalcrazypony', video: true)-play(new \danog\MadelineProto\RemoteUrl('https://paste.daniil.it/oncall.webm'));
}
$MadelineProto-echo('OK, done!');


Try running this code in a browser or in a console!  


Tip: if you receive an error (or nothing), send us the error message and the MadelineProto.log file that was created in the same directory (if running from a browser).  

 Made with MadelineProto

The following open source projects were created using MadelineProto: you can directly install them, or explore the source code as direct examples on how to use MadelineProto's many features!

 magnaluna webradio - Multifeatured Telegram VoIP webradio
 simpleBot.php - Extremely basic example
 tgstories_dl_bot.php - Source code of @tgstories_dl_bot - Bot to download any Telegram Story!
 downloadRenameBot.php - Download files by URL and rename Telegram files using this async parallelized bot!
 secret_bot.php - Secret chat bot!
 pipesbot.php - Creating inline bots and using other inline bots via a userbot!
 bot.php - Examples for how to use filters, updates, get download links for any file, Telegram Stories and much more!

Want to add your own open-source project to this list? Click here!

Some of MadelineProto's core components are also available as separate, standalone libraries:

- danog/async-orm - Async ORM based on AMPHP v3 and fibers. 
- danog/telegram-entities - A library to work with Telegram UTF-16 styled text entities. 
- danog/tg-file-decoder - A library to work with Telegram bot API file IDs.
- danog/tg-dialog-id - A library to work with Telegram bot API dialog IDs. 
- danog/loop - Loop/actor model abstraction for AMPHP.
- danog/better-prometheus - A better Prometheus library for PHP applications.
- danog/ipc - Async IPC component for AMPHP.
- danog/dns-over-h

Top issues

Discussions

Latest release

8.21.2 8.21.2 2026-11-11
What's Changed
 Internal changes
 Automatic build (layer 233) by @madelineproto-autobuild[bot] in https://github.com/danog/MadelineProto/pull/1996
 Bump vitest from 5.0.5 to 5.1.0 in /webui by @dependabot[bot] in https://github.com/danog/MadelineProto/pull/1998
 Bump sass from 1.107.0 to 1.108.0 in /webui by @dependabot[bot] in https://github.com/danog/MadelineProto/pull/2001
 Update friendsofphp/php-cs-fixer requirement from 3.95.27 to 3.95.28 in /vendor-bin/check by @dependabot[bot] in https://github.com/danog/MadelineProto/pull/1999
 Bump jsdom from 30.1.3 to 31.0.0 in /webui by @dependabot

Snapshot: 2026-11-11T15:31:17Z · Data license Apache-2.0 · JSON