PHP Other
Clone or download
Latest commit f1b6802 Jul 17, 2018
Permalink
Failed to load latest commit information.
docs @ 1554397 TL bugfixes Jul 17, 2018
lua Clean up API ID references May 8, 2018
src TL bugfixes Jul 17, 2018
tests Use media DCs for file operations Jun 29, 2018
userbots Clean up API ID references May 8, 2018
.babelrc Localization (#195) Oct 1, 2017
.env.example Improve docs Mar 30, 2018
.gitignore Update to layer 82, implement media DC key exchange, revert logger AP… Jun 29, 2018
.gitmodules Update docs Apr 1, 2018
.travis.yml Fixes for micro http-client (phar_release) Feb 22, 2018
CHANGELOG.md You can now proxy MadelineProto Jun 3, 2017
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md (#167) Aug 7, 2017
CONTRIBUTING.md Bugfixes Feb 13, 2017
LICENSE Reorganized code Aug 8, 2016
README.md Update docs Jul 11, 2018
bot.php Clean up API ID references May 8, 2018
build_docs.php Update to layer 82, implement media DC key exchange, revert logger AP… Jun 29, 2018
build_docs_index.php Apply fixes from StyleCI Apr 11, 2018
composer.json Update composer.json May 14, 2018
index.php Clean up API ID references May 8, 2018
input.raw Try to avoid serialization issues Jul 24, 2017
magna.php fix Jul 13, 2018
makephar.php Self-update mtproxyd May 10, 2018
mtproxyd Cache avoidance May 10, 2018
multiprocess_bot.php Improve docs Mar 30, 2018
phar.php Cache avoidance May 10, 2018
phartesting.php Implement socket interface Mar 4, 2018
secret_bot.php Improve docs Mar 30, 2018
songs.php Calling count() only once, before using 'for' loop (#313) Feb 25, 2018
translator.php TOS update, update to layer 81, improve GUI/cli interface Jun 29, 2018

README.md

MadelineProto, a PHP MTProto telegram client

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

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

Getting started

<?php

if (!file_exists('madeline.php')) {
    copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php');
}
include 'madeline.php';

$MadelineProto = new \danog\MadelineProto\API('session.madeline');
$MadelineProto->start();

$me = $MadelineProto->get_self();

\danog\MadelineProto\Logger::log($me);

if (!$me['bot']) {
    $MadelineProto->messages->sendMessage(['peer' => '@danogentili', 'message' => "Hi!\nThanks for creating MadelineProto! <3"]);
    $MadelineProto->channels->joinChannel(['channel' => '@MadelineProto']);

    try {
        $MadelineProto->messages->importChatInvite(['hash' => 'https://t.me/joinchat/Bgrajz6K-aJKu0IpGsLpBg']);
    } catch (\danog\MadelineProto\RPCErrorException $e) {
    }

    $MadelineProto->messages->sendMessage(['peer' => 'https://t.me/joinchat/Bgrajz6K-aJKu0IpGsLpBg', 'message' => 'Testing MadelineProto!']);
}
echo 'OK, done!'.PHP_EOL;

Try this code now! or run 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).

Documentation

Very complex and complete examples

You can find examples for nearly every MadelineProto function in