Awesome Open Source
Awesome Open Source

Asynchronous PHP Telegram Bot Framework built on top of ReactPHP

Bot API PHP Build Status Scrutinizer Code Quality Code style License


Features

  • Long polling support (no webserver required)
  • Middleware chain for requests
  • Conversations and sessions (no database required)
  • Based on ReactPHP asynchronous non-blocking I/O model
  • Scheduled functions/timers provided by ReactPHP
  • Bulk message sending (no more 429 annoying errors)
  • Full Telegram Bot Api 5.0 support (November 2020)

Installation

composer require badfarm/zanzara

Quickstart

Create a file named bot.php and paste the following code:

<?php

use Zanzara\Zanzara;
use Zanzara\Context;

require __DIR__ . '/vendor/autoload.php';

$bot = new Zanzara("YOUR-BOT-TOKEN");

$bot->onCommand('start', function (Context $ctx) {
    $ctx->sendMessage('Hello');
});

$bot->run();

Then run it from command line as follows:

$ php bot.php

Enjoy your bot!

Check Wiki for documentation.


Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
php (15,954
bot (702
telegram (318
telegram-bot (160
telegram-bot-api (41
asynchronous-programming (27
reactphp (25

Find Open Source By Browsing 7,000 Topics Across 59 Categories