badfarm / zanzara

Asynchronous PHP Telegram Bot Framework built on top of ReactPHP
MIT License
201 stars 28 forks source link
asynchronous-programming bot php reactphp telegram telegram-bot telegram-bot-api

Asynchronous PHP Telegram Bot Framework built on top of ReactPHP

Bot API PHP Build Code style License


Features

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 out the Wiki for documentation.