tigris / tigris
Tigris is a modern Telegram bot framework written in PHP
Installs: 87
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 3
Open Issues: 0
pkg:composer/tigris/tigris
Requires
- php: >=7.0
- react/react: ^0.4.2
- tigris/telegram-bot-api: ~3.2
- yarcode/simple-events: *
Requires (Dev)
- phpunit/phpunit: ~4.8
This package is not auto-updated.
Last update: 2025-10-06 10:55:16 UTC
README
Tigris is a modern reactive event-driven Telegram bot framework written in PHP.
Usage
Without extending the Bot class
Create a bot instance
$bot = (new BotFactory())->create($apiToken);
Define your custom even handlers
$bot = (new BotFactory())->create($apiToken); $bot->addListener(MessageEvent::EVENT_TEXT_MESSAGE_RECEIVED, function (MessageEvent $event) use ($bot) { // sending your first message $bot->getApi()->sendMessage([ 'chat_id' => $event->message->chat->id, 'text' => 'Hello World!', ]); });
Run your bot
$bot->run();
Extending the Bot class
Extend the Tigris\Bot class to create your own bot implementation
class SampleBot extends \Tigris\Bot { // bootstraping your bot public function bootstrap() { // registering event callback $this->addListener(MessageEvent::EVENT_TEXT_MESSAGE_RECEIVED, function (MessageEvent $event) { // sending your first message $this->getApi()->sendMessage([ 'chat_id' => $event->message->chat->id, 'text' => 'Hello World!', ]); }); } }
Run the bot instance
$bot = (new BotFactory(SampleBot::class))->create($apiToken); $bot->run();
License
MIT