This is PHP Library for Telegram Bot Platform.
You can follow this documentation to work with the library.
The recommended way to install is through Composer:
composer require jungle-bay/telegram-bot-platform
<?php
require_once __DIR__ . DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, array('vendor', 'autoload.php'));
$request = file_get_contents('php://input'); // Request body. (JSON-serialized Update object)
$tbp = new \TelegramBotPlatform\TelegramBotPlatform(array(
'token' => '123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11', // Your token bot.
'storage' => $adapter, // This adapter for Scrapbook library to store user sessions. See the complete adapters: https://github.com/matthiasmullie/scrapbook#adapters
'payload' => null, // This payload will be passed for third parameter to command. (optional)
'mappings' => array(
'default' => \MyBot\Commands\DefaultCmd::class, // This command will work by default if no command is found or user session. (optional)
'inline_query' => \MyBot\Commands\FeedbackInlineQueryCmd::class, // This command will work with inline queries. (optional)
'commands' => array( // This is the list of registered commands for the bot. (optional)
'help' => \MyBot\Commands\HelpCmd::class,
'user' => \MyBot\Commands\UserCmd::class
)
)
), $request);
$tbp->run();
See the complete docs in here.
For the convenience of development, you can use Telegram Bot CLI.
This bundle is under the MIT license. See the complete license in the file: here.