vlotysh / bot-gram-php
PHP client for telegram
0.0.3
2023-11-17 13:07 UTC
Requires
- php: ^8.0
- ext-json: *
- guzzlehttp/guzzle: ^7.0
Requires (Dev)
- mockery/mockery: ^1.6
- phpunit/phpunit: ^8.5.29 || ^9.5.23
README
PHP library for Telegram API
$updateData = file_get_contents("php://input"); $handler = new Handler(); # with bot key $bot = new Bot('000000:AAAAAAAAAAAAAAAAAAAAAA'); # add command handler $handler->addCallback('/^\/like/', function () use ($bot, $chatId) { $replyMarkup = array( 'inline_keyboard' => [ [ [ 'text' => "Yes", 'callback_data' => 'yes', ], [ 'text' => "No", 'callback_data' => 'no', ], ] ], ); $bot->sendMessage($chatId, 'Like bot?', $replyMarkup); }); $handler->execute($updateData);