vlotysh/bot-gram-php

PHP client for telegram

0.0.3 2023-11-17 13:07 UTC

This package is auto-updated.

Last update: 2024-09-17 15:03:50 UTC


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);