parsoolak / zanzara
Asynchronous PHP Telegram Bot Framework
0.9.2
2023-07-09 10:24 UTC
Requires
- php: >=7.4
- ext-json: *
- ext-readline: *
- clue/http-proxy-react: ^1.8
- netresearch/jsonmapper: ^4.1
- opis/closure: ^3.6
- php-di/php-di: ^6.4
- php-http/multipart-stream-builder: ^1.2
- psr/container: ^1.1
- psr/log: ^1.1
- react/cache: ^1.2
- react/event-loop: ^1.3
- react/http: ^1.8
Requires (Dev)
- monolog/monolog: ^2.9
- phpunit/phpunit: ^9.6
- symfony/dotenv: ^5.4
This package is auto-updated.
Last update: 2025-01-09 14:06:09 UTC
README
Asynchronous PHP Telegram Bot Framework built on top of ReactPHP
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)
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.