kix / zanzara
Asynchronous PHP Telegram Bot Framework
0.9.2
2025-02-18 21:37 UTC
Requires
- php: ^8.0
- ext-json: *
- ext-readline: *
- clue/http-proxy-react: ^1.8
- netresearch/jsonmapper: ^4.1
- nyholm/psr7: ^1.8
- opis/closure: ^4.0
- php-di/php-di: ^7.0
- 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.9.0
Requires (Dev)
- monolog/monolog: ^2.9
- phpunit/phpunit: ^9.6
- symfony/dotenv: ^5.4
This package is auto-updated.
Last update: 2025-02-25 11:56:51 UTC
README
Asynchronous PHP Telegram Bot Framework built on top of ReactPHP
NOTE: This is a fork of the original repository
The original maintainer does not seem to actively contribute to the project anymore. If my merge requests get accepted, I'll close this down and deprecate it in favour of the original library.
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 kix/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.