PHPackages                             ayaya118/simple-telegram-bot-api - 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. ayaya118/simple-telegram-bot-api

ActiveLibrary[API Development](/categories/api)

ayaya118/simple-telegram-bot-api
================================

PHP Wrapper for Telegram Bot API

v1.0.2(2y ago)03MITPHPPHP &gt;=5.5.0

Since Mar 30Pushed 2y agoCompare

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

READMEChangelog (2)Dependencies (9)Versions (3)Used By (0)

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)[![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 ayaya118/simple-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');

    //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();
}
```

#### Local Bot API Server

[](#local-bot-api-server)

For using custom [local bot API server](https://core.telegram.org/bots/api#using-a-local-bot-api-server)

```
use TelegramBot\Api\Client;
$token = 'YOUR_BOT_API_TOKEN';
$bot = new Client($token, null, null, 'http://localhost:8081');
```

#### Third-party Http Client

[](#third-party-http-client)

```
use Symfony\Component\HttpClient\HttpClient;
use TelegramBot\Api\BotApi;
use TelegramBot\Api\Http\SymfonyHttpClient;
$token = 'YOUR_BOT_API_TOKEN';
$bot = new Client($token, null, new SymfonyHttpClient(HttpClient::create()););
```

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

20

↓

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 66% 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

Every ~15 days

Total

2

Last Release

756d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7adf6c50d70e92d44317f40eb4b840427c0ea1ab45b8e7ddf686d2f7fd12b79f?d=identicon)[ayaya118](/maintainers/ayaya118)

---

Top Contributors

[![iGusev](https://avatars.githubusercontent.com/u/1555767?v=4)](https://github.com/iGusev "iGusev (347 commits)")[![BoShurik](https://avatars.githubusercontent.com/u/1428848?v=4)](https://github.com/BoShurik "BoShurik (66 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)")[![bernard-ng](https://avatars.githubusercontent.com/u/31113941?v=4)](https://github.com/bernard-ng "bernard-ng (11 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)")[![vitorbari](https://avatars.githubusercontent.com/u/1184252?v=4)](https://github.com/vitorbari "vitorbari (4 commits)")[![muhammadmp97](https://avatars.githubusercontent.com/u/17279395?v=4)](https://github.com/muhammadmp97 "muhammadmp97 (3 commits)")[![numairawan](https://avatars.githubusercontent.com/u/62851858?v=4)](https://github.com/numairawan "numairawan (3 commits)")[![ayaya118](https://avatars.githubusercontent.com/u/4150721?v=4)](https://github.com/ayaya118 "ayaya118 (2 commits)")[![SergeAx](https://avatars.githubusercontent.com/u/3264530?v=4)](https://github.com/SergeAx "SergeAx (2 commits)")[![nikserg](https://avatars.githubusercontent.com/u/5680589?v=4)](https://github.com/nikserg "nikserg (2 commits)")[![7eodorus](https://avatars.githubusercontent.com/u/38510234?v=4)](https://github.com/7eodorus "7eodorus (1 commits)")[![flaksp](https://avatars.githubusercontent.com/u/12474739?v=4)](https://github.com/flaksp "flaksp (1 commits)")[![nullform](https://avatars.githubusercontent.com/u/4964609?v=4)](https://github.com/nullform "nullform (1 commits)")[![Aj-github-cmd](https://avatars.githubusercontent.com/u/55585727?v=4)](https://github.com/Aj-github-cmd "Aj-github-cmd (1 commits)")[![palehin](https://avatars.githubusercontent.com/u/14148595?v=4)](https://github.com/palehin "palehin (1 commits)")

---

Tags

phpbottelegrambot api

###  Code Quality

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

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