This package is abandoned and no longer maintained. No replacement package was suggested.

The inline menu for the longman/telegram-bot library!

1.3.0 2021-03-15 14:29 UTC

This package is auto-updated.

Last update: 2022-05-15 16:50:43 UTC


It's the inline menu for the longman/telegram-bot library!


  • Inline-menu with sub-menus.
  • Call a bot command by inline button.
  • Toast message!


Require this package with Composer

Install this package through Composer. Edit your project's composer.json file to require californiamountainsnake/longmantelegrambot-inlinemenu:

    "name": "yourproject/yourproject",
    "type": "project",
    "require": {
        "php": "^7.3.1",
        "californiamountainsnake/longmantelegrambot-inlinemenu": "*"

and run composer update


run this command in your command line:

composer require californiamountainsnake/longmantelegrambot-inlinemenu


  1. Extend your Telegram class from InlineMenuTelegram (or include the InlineMenuTelegramTrait into your existed Telegram class):
// Create your own Telegram class:
class MyTelegram extends InlineMenuTelegram


// somewhere in the webhook.php:
$telegram = new MyTelegram($bot_api_key, $bot_username);
  1. Create your Menu object:
$menu = new Menu('Top root menu', 'root', [
        InlineButton::startCommand('Help!', 'help'),
        InlineButton::url('It\'s google', ''),
        InlineButton::toast('toast_identifier', 'Toast text!'),
        new Menu('Sub menu', 'submenu', [
            InlineButton::toast('sub_menu_toast', 'Submenu toast!'),
            InlineButton::menuSection('<< Back', Menu::path('root'))

// You must call this method once only on the your TOP level menu object.
  1. Extend your standard CallbackqueryCommand from InlineMenuCallbackqueryCommand and realise abstract methods:
class CallbackqueryCommand extends InlineMenuCallbackqueryCommand
    protected function getRootMenu(): Menu
        // return the Menu object from the previous step
        return new Menu (...);
  1. Get standard Longman\TelegramBot\Entities\InlineKeyboard object and use it in Request::sendMessage () in your commands:
$menu = new Menu (...);
$inlineKeyboard = $menu->getInlineKeyboard();

    'chat_id' => 'some_chat_id',
    'text' => 'This is menu!',
    'reply_markup' => $inlineKeyboard,