PHPackages                             telegram-bot-api/for-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. telegram-bot-api/for-bundle

ActiveLibrary[API Development](/categories/api)

telegram-bot-api/for-bundle
===========================

PHP Wrapper for Telegram Bot API

v1.0(3y ago)0501MITPHPPHP &gt;=5.5.0

Since Jan 28Pushed 3y ago1 watchersCompare

[ Source](https://github.com/EvMV/telegram-bot-api-for-bundle)[ Packagist](https://packagist.org/packages/telegram-bot-api/for-bundle)[ Docs](https://github.com/TelegramBot/Api)[ RSS](/packages/telegram-bot-api-for-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (1)

PHP Telegram Bot Api
====================

[](#php-telegram-bot-api)

[![Latest Version on Packagist](https://camo.githubusercontent.com/138001fd8cc6931e0a940d2dd831349d6bebbcbf255cccf52b5fd0a933252d65/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f74656c656772616d2d626f742f6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/telegram-bot/api)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/e25d624320cdb80fada9cfa0c378726b368dc6d440b55179ad0dd477f77a39a5/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f54656c656772616d426f742f4170692f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/TelegramBot/Api)[![Coverage Status](https://camo.githubusercontent.com/4de92800fbf4529b39334f01a558d71159248ea2dae3968595ae9ae2ea90aac0/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f74656c656772616d626f742f6170692e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/telegrambot/api/code-structure)[![Quality Score](https://camo.githubusercontent.com/09d0e60b320c3860ce73b183a76d282b3cbcdb0304981d641f4e616986e6394b/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f74656c656772616d626f742f6170692e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/telegrambot/api)[![Total Downloads](https://camo.githubusercontent.com/bc844cb26485029a6ca0f8c47c5c28e23939015d844358ef98384eb0001013d1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f74656c656772616d2d626f742f6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/telegram-bot/api)

An extended native php wrapper for [Telegram Bot API](https://core.telegram.org/bots/api) without requirements. Supports all methods and types of responses.

Bots: An introduction for developers
------------------------------------

[](#bots-an-introduction-for-developers)

> Bots are special Telegram accounts designed to handle messages automatically. Users can interact with bots by sending them command messages in private or group chats.

> You control your bots using HTTPS requests to [bot API](https://core.telegram.org/bots/api).

> The Bot API is an HTTP-based interface created for developers keen on building bots for Telegram. To learn how to create and set up a bot, please consult [Introduction to Bots](https://core.telegram.org/bots) and [Bot FAQ](https://core.telegram.org/bots/faq).

Installation
------------

[](#installation)

Via Composer

```
$ composer require telegram-bot/api
```

Usage
-----

[](#usage)

See example [DevAnswerBot](https://github.com/TelegramBot/DevAnswerBot) (russian).

### API Wrapper

[](#api-wrapper)

#### Send message

[](#send-message)

```
$bot = new \TelegramBot\Api\BotApi('YOUR_BOT_API_TOKEN');

$bot->sendMessage($chatId, $messageText);
```

#### Send document

[](#send-document)

```
$bot = new \TelegramBot\Api\BotApi('YOUR_BOT_API_TOKEN');

$document = new \CURLFile('document.txt');

$bot->sendDocument($chatId, $document);
```

#### Send message with reply keyboard

[](#send-message-with-reply-keyboard)

```
$bot = new \TelegramBot\Api\BotApi('YOUR_BOT_API_TOKEN');

$keyboard = new \TelegramBot\Api\Types\ReplyKeyboardMarkup(array(array("one", "two", "three")), true); // true for one-time keyboard

$bot->sendMessage($chatId, $messageText, null, false, null, $keyboard);
```

#### Send message with inline keyboard

[](#send-message-with-inline-keyboard)

```
$bot = new \TelegramBot\Api\BotApi('YOUR_BOT_API_TOKEN');

$keyboard = new \TelegramBot\Api\Types\Inline\InlineKeyboardMarkup(
            [
                [
                    ['text' => 'link', 'url' => 'https://core.telegram.org']
                ]
            ]
        );

$bot->sendMessage($chatId, $messageText, null, false, null, $keyboard);
```

#### Send media group

[](#send-media-group)

```
$bot = new \TelegramBot\Api\BotApi('YOUR_BOT_API_TOKEN');

$media = new \TelegramBot\Api\Types\InputMedia\ArrayOfInputMedia();
$media->addItem(new TelegramBot\Api\Types\InputMedia\InputMediaPhoto('https://avatars3.githubusercontent.com/u/9335727'));
$media->addItem(new TelegramBot\Api\Types\InputMedia\InputMediaPhoto('https://avatars3.githubusercontent.com/u/9335727'));
// Same for video
// $media->addItem(new TelegramBot\Api\Types\InputMedia\InputMediaVideo('http://clips.vorwaerts-gmbh.de/VfE_html5.mp4'));
$bot->sendMediaGroup($chatId, $media);
```

#### Client

[](#client)

```
require_once "vendor/autoload.php";

try {
    $bot = new \TelegramBot\Api\Client('YOUR_BOT_API_TOKEN');
    // or initialize with botan.io tracker api key
    // $bot = new \TelegramBot\Api\Client('YOUR_BOT_API_TOKEN', 'YOUR_BOTAN_TRACKER_API_KEY');

    //Handle /ping command
    $bot->command('ping', function ($message) use ($bot) {
        $bot->sendMessage($message->getChat()->getId(), 'pong!');
    });

    //Handle text messages
    $bot->on(function (\TelegramBot\Api\Types\Update $update) use ($bot) {
        $message = $update->getMessage();
        $id = $message->getChat()->getId();
        $bot->sendMessage($id, 'Your message: ' . $message->getText());
    }, function () {
        return true;
    });

    $bot->run();

} catch (\TelegramBot\Api\Exception $e) {
    $e->getMessage();
}
```

### Botan SDK (not supported more)

[](#botan-sdk-not-supported-more)

[Botan](http://botan.io) is a telegram bot analytics system based on [Yandex.Appmetrica](http://appmetrica.yandex.com/). In this document you can find how to setup Yandex.Appmetrica account, as well as examples of Botan SDK usage.

### Creating an account

[](#creating-an-account)

- Register at
- After registration you will be prompted to create Application. Please use @YourBotName as a name.
- Save an API key from settings page, you will use it as a token for Botan API calls.
- Download lib for your language, and use it as described below. Don`t forget to insert your token!

Since we are only getting started, you may discover that some existing reports in AppMetriсa aren't properly working for Telegram bots, like Geography, Gender, Age, Library, Devices, Traffic sources and Network sections. We will polish that later.

SDK usage
---------

[](#sdk-usage)

#### Standalone

[](#standalone)

```
$tracker = new \TelegramBot\Api\Botan('YOUR_BOTAN_TRACKER_API_KEY');

$tracker->track($message, $eventName);
```

#### API Wrapper

[](#api-wrapper-1)

```
$bot = new \TelegramBot\Api\BotApi('YOUR_BOT_API_TOKEN', 'YOUR_BOTAN_TRACKER_API_KEY');

$bot->track($message, $eventName);
```

You can use method 'getUpdates()'and all incoming messages will be automatically tracked as `Message`-event.

#### Client

[](#client-1)

```
$bot = new \TelegramBot\Api\Client('YOUR_BOT_API_TOKEN', 'YOUR_BOTAN_TRACKER_API_KEY');
```

*All registered commands are automatically tracked as command name*

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Ilya Gusev](https://github.com/iGusev)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community22

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 76.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1206d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cb5674d337b262e80b3f9024191e3d1fadc1ccd1165f41fac205a09289438b51?d=identicon)[EvMV](/maintainers/EvMV)

---

Top Contributors

[![iGusev](https://avatars.githubusercontent.com/u/1555767?v=4)](https://github.com/iGusev "iGusev (346 commits)")[![TheMY3](https://avatars.githubusercontent.com/u/9335727?v=4)](https://github.com/TheMY3 "TheMY3 (28 commits)")[![MyZik](https://avatars.githubusercontent.com/u/12817320?v=4)](https://github.com/MyZik "MyZik (20 commits)")[![uc-itcom](https://avatars.githubusercontent.com/u/21470696?v=4)](https://github.com/uc-itcom "uc-itcom (9 commits)")[![POPSuL](https://avatars.githubusercontent.com/u/683358?v=4)](https://github.com/POPSuL "POPSuL (5 commits)")[![lopatinas](https://avatars.githubusercontent.com/u/4607426?v=4)](https://github.com/lopatinas "lopatinas (5 commits)")[![hb220](https://avatars.githubusercontent.com/u/6212880?v=4)](https://github.com/hb220 "hb220 (4 commits)")[![EvMV](https://avatars.githubusercontent.com/u/85056538?v=4)](https://github.com/EvMV "EvMV (4 commits)")[![vitorbari](https://avatars.githubusercontent.com/u/1184252?v=4)](https://github.com/vitorbari "vitorbari (4 commits)")[![BoShurik](https://avatars.githubusercontent.com/u/1428848?v=4)](https://github.com/BoShurik "BoShurik (3 commits)")[![muhammadmp97](https://avatars.githubusercontent.com/u/17279395?v=4)](https://github.com/muhammadmp97 "muhammadmp97 (3 commits)")[![nikserg](https://avatars.githubusercontent.com/u/5680589?v=4)](https://github.com/nikserg "nikserg (2 commits)")[![SergeAx](https://avatars.githubusercontent.com/u/3264530?v=4)](https://github.com/SergeAx "SergeAx (2 commits)")[![Scarboroid](https://avatars.githubusercontent.com/u/8564676?v=4)](https://github.com/Scarboroid "Scarboroid (1 commits)")[![SergeyTrifonov](https://avatars.githubusercontent.com/u/4227170?v=4)](https://github.com/SergeyTrifonov "SergeyTrifonov (1 commits)")[![stelzek](https://avatars.githubusercontent.com/u/188165?v=4)](https://github.com/stelzek "stelzek (1 commits)")[![vlydev](https://avatars.githubusercontent.com/u/2308269?v=4)](https://github.com/vlydev "vlydev (1 commits)")[![wwwebc](https://avatars.githubusercontent.com/u/2277100?v=4)](https://github.com/wwwebc "wwwebc (1 commits)")[![choldimir](https://avatars.githubusercontent.com/u/3314672?v=4)](https://github.com/choldimir "choldimir (1 commits)")[![div-production](https://avatars.githubusercontent.com/u/19323493?v=4)](https://github.com/div-production "div-production (1 commits)")

---

Tags

phpbottelegrambot api

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/telegram-bot-api-for-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/telegram-bot-api-for-bundle/health.svg)](https://phpackages.com/packages/telegram-bot-api-for-bundle)
```

###  Alternatives

[telegram-bot/api

PHP Wrapper for Telegram Bot API

1.2k2.4M29](/packages/telegram-bot-api)[telegram-bot-php/core

A PHP library that makes using Telegram Bot API much easier.

60293.1k](/packages/telegram-bot-php-core)[borsaco/telegram-bot-api-bundle

A simple wrapper for telegram-bot-api.

5633.0k](/packages/borsaco-telegram-bot-api-bundle)[kuvardin/telegram-bots-api

SDK for Telegram bots API

145.5k](/packages/kuvardin-telegram-bots-api)[klev-o/telegram-bot-api

Simple and convenient object-oriented implementation Telegram bot API with php version ^7.4 support. You'll like it)

457.8k1](/packages/klev-o-telegram-bot-api)[luzrain/telegram-bot-api

PHP Wrapper for Telegram Bot API

1032.8k1](/packages/luzrain-telegram-bot-api)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
