jungle-bay/telegram-bot-platform

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

PHP Library for Telegram Bot Platform

1.2 2018-01-20 21:55 UTC

This package is not auto-updated.

Last update: 2024-01-08 21:28:14 UTC


README

Telegram Bot Platform Logo

Telegram Bot Platform

Travis CI Scrutinizer CI Codecov

This is PHP Library for Telegram Bot Platform.
You can follow this documentation to work with the library.

Install

The recommended way to install is through Composer:

composer require jungle-bay/telegram-bot-platform

The simplest example of use

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

Docs

See the complete docs in here.

Note

For the convenience of development, you can use Telegram Bot CLI.

License

This bundle is under the MIT license. See the complete license in the file: here.