Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
M

MadelineProto

> 编程语言
Open source

Async PHP client API for the telegram MTProto protocol

3.5K stars0 likes3 views
WebsiteGitHub

About

Async PHP client API for the telegram MTProto protocol

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!)

…

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-https - Async DNS-over-HTTPS resolution for AMPHP.

Documentation

  • Creating a client - This page explains how to create a MadelineProto instance.
  • Login - There are many ways you can login with MadelineProto.
    • Getting permission to use the telegram API
    • Automatic
    • Manual (user)
      • API ID
    • Manual (bot)
    • QR code login (user)
  • Features - MadelineProto can do everything official clients can do, and more!
  • Requirements - MadelineProto requires the mbstring, xml, json, fileinfo, gmp, openssl, iconv, gd extensions to function properly.
  • MadelineProto on Docker - MadelineProto offers an official MadelineProto docker image for the linux/amd64, linux/arm64 and linux/riscv64 platforms @ hub.madelineproto.xyz/danog/madelineproto.
    • Getting started
      • CLI bot (recommended)
      • Databases on docker
      • Web docker
      • Custom extensions
  • Metrics - MadelineProto can expose many useful metrics, that can be visualized using the official MadelineProto Grafana dashboard.
  • Installation - There are various ways to install MadelineProto:
    • Simple
    • Composer from existing project
    • Composer from scratch
  • Broadcasting messages to all users - MadelineProto can be used to broadcast messages to all users, chats and channels of a bot or userbot.
  • Handling updates (new messages & other events) - Update handling can be done in different ways:
    • Async Event driven
      • Full example
      • Bound methods
      • Filters
        • Simple filters
        • Attribute filters
        • MTProto filters
      • Plugins
      • Cron
      • Persisting data and IPC
      • Built-in ORM
      • IPC
      • Restarting
      • Self-restart on webhosts
      • Multi-account
      • Automatic static analysis
      • Avoiding the use of filesystem functions
    • Webhook (for HTTP APIs)
    • getUpdates (only for Javascript APIs)
    • Noop (default)
    • danog\MadelineProto\Broadcast\Progress » - Broadcast progress.
    • danog\MadelineProto\EventHandler\AbstractMessage » - Represents an incoming or outgoing message.
    • danog\MadelineProto\EventHandler\AbstractPrivateMessage » - Represents a private or secret chat message.
    • danog\MadelineProto\EventHandler\AbstractStory » - Represents a Telegram Story.
    • danog\MadelineProto\EventHandler\BotCommands » - The command set of a certain bot in a certain chat has changed.
    • danog\MadelineProto\EventHandler\CallbackQuery » - Represents a query sent by the user by clicking on a button.
    • danog\MadelineProto\EventHandler\Channel\ChannelParticipant » - A participant has left, joined, was banned or admin'd in a channel or supergroup.
    • danog\MadelineProto\EventHandler\Channel\MessageForwards » - Indicates that the forward counter of a message in a channel has changed.
    • danog\MadelineProto\EventHandler\Channel\MessageViewsChanged » - Indicates that the view counter of a message in a channel has changed.
    • danog\MadelineProto\EventHandler\Channel\UpdateChannel » - A new channel is available, or info about an existing channel was changed.
    • danog\MadelineProto\EventHandler\ChatInviteRequester » - Indicates someone has requested to join a chat or channel.
    • danog\MadelineProto\EventHandler\ChatInviteRequester\BotChatInviteRequest » - Indicates someone has requested to join a chat or channel (bots only).
    • danog\MadelineProto\EventHandler\ChatInviteRequester\PendingJoinRequests » - Someone has requested to join a chat or channel.
    • danog\MadelineProto\EventHandler\Delete » - Indicates that some messages were deleted.
    • danog\MadelineProto\EventHandler\Delete\DeleteChannelMessages » - Some messages in a supergroup/channel were deleted.
    • danog\MadelineProto\EventHandler\Delete\DeleteMessages » - Some messages were deleted in a private chat or simple group.
    • danog\MadelineProto\EventHandler\Delete\DeleteScheduledMessages » - Some scheduled messages were deleted from the schedule queue of a chat.
    • [danog\MadelineProto\EventHandler\I

GitHub Issues· 75 open

View all on GitHub
  • #1755

    Hi

    Updated Sep 6, 2026
  • #1754

    src/DataCenter.php

    Updated Sep 4, 2026
  • #1752

    Can I find out the date the buser for telegram deleted the account

    Updated Aug 21, 2026
  • #1751

    25';(?)

    Updated Aug 10, 2026
  • #1750

    Bot hangs (zombie state) instead of crashing on TimeoutException in updates.getChannelDifference

    Updated Jul 10, 2026
  • #1715

    ক্বের‍্যুইওপ

    Updated Jun 26, 2026
  • #1713

    সজবক

    Updated Jun 23, 2026
  • #1684

    Telegram

    Updated Jun 17, 2026
  • #1710

    Bug: Typed property MTProto::$logger accessed before initialization during session deserialization

    Updated Jun 14, 2026
  • #1741

    AssertionError: Unknown entity type: messageEntityFormattedDate

    Updated Jun 12, 2026

Highlights

  • •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!
  • •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.

> Tags

PHPamphpasyncbotcalls

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言