PHPackages                             sumrak/telegram-bot - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. sumrak/telegram-bot

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

sumrak/telegram-bot
===================

PHP 7 Object-based Telegram Bot Library

1.0.3(5y ago)013MITPHPPHP ^7.2.0

Since Aug 20Pushed 5y ago1 watchersCompare

[ Source](https://github.com/NikolasSumrak/telegram-bot)[ Packagist](https://packagist.org/packages/sumrak/telegram-bot)[ RSS](/packages/sumrak-telegram-bot/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (2)Dependencies (8)Versions (5)Used By (0)

Telegram Bot
============

[](#telegram-bot)

[![Latest Version](https://camo.githubusercontent.com/4bf1ace5394fbdfc4da74a5dc9406fc88fe38f9bd19106a8c5bc1d33b2067014/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f7461672f4e696b6f6c617353756d72616b2f74656c656772616d2d626f743f6c6162656c3d4c6174657374267374796c653d666c61742d737175617265)](https://github.com/NikolasSumrak/telegram-bot/releases)[![Travis (.com) branch](https://camo.githubusercontent.com/6bee8267234bc09ce4c5d2deb55c57472b18f2d15da220749ca17df08d9e8038/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f636f6d2f4e696b6f6c617353756d72616b2f74656c656772616d2d626f742f6d61737465723f7374796c653d666c61742d737175617265)](https://travis-ci.com/github/NikolasSumrak/telegram-bot)[![Total Downloads](https://camo.githubusercontent.com/dcbb7dfacb1313d8cac3f6b1f28ea45b5b330483480e68810264a9e55024eaf0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73756d72616b2f74656c656772616d2d626f742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sumrak/telegram-bot)[![Coverage](https://camo.githubusercontent.com/47d243bfd8b4d7d6a1c42004ea09acd708315f8da8a92a63f48bb854daad55f0/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f4e696b6f6c617353756d72616b2f74656c656772616d2d626f743f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/47d243bfd8b4d7d6a1c42004ea09acd708315f8da8a92a63f48bb854daad55f0/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f4e696b6f6c617353756d72616b2f74656c656772616d2d626f743f7374796c653d666c61742d737175617265)

Based on objects (all data is objects).

Installation
============

[](#installation)

```
composer require sumrak/telegram-bot

```

Usage:
======

[](#usage)

```
$botContext = new \Sumrak\TelegramBot\TelegramBotContext('your api token here');
$bot = new \Sumrak\TelegramBot\TelegramBot($botContext);
```

Getting updates
---------------

[](#getting-updates)

```
$updates = $bot->getUpdates();

foreach ($updates as $update) {
    echo $update->getUpdateId();
    echo ": ";
    if ($update->getMessage()) {
        echo $update->getMessage()->getChat()->getId() . ' - ' . $update->getMessage()->getText();
        $lastMessageId = $update->getMessage()->getMessageId();
    } else {
        echo 'Not Message Update';
    }
    echo PHP_EOL;
}
```

Get request in Webhook
----------------------

[](#get-request-in-webhook)

```
$content = file_get_contents('php://input');
$serializer = new \Sumrak\TelegramBot\Serializer\TelegramApiSerializer();
$update = $serializer->deserialize(\Sumrak\TelegramBot\Entity\Update::class, $content);
```

### Sending Messages

[](#sending-messages)

```
$replyMarkup = new \Sumrak\TelegramBot\Entity\ReplyKeyboardMarkup();
$button1 = new \Sumrak\TelegramBot\Entity\KeyboardButton();
$button1->setText('Button1');

$button2 = new \Sumrak\TelegramBot\Entity\KeyboardButton();
$button2->setText('Button2');
$replyMarkup->setKeyboard([[
    $button1,
    $button2
]]);

$bot->sendMessage(
    218081419,
    'Some Text',
    \Sumrak\TelegramBot\TelegramBot::PARSE_MODE_MARKDOWN_V2,
    null,
    null,
    $lastMessageId,
    $replyMarkup
);
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~86 days

Total

4

Last Release

1839d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4971799?v=4)[Mikalai Puchko](/maintainers/NikolasSumrak)[@NikolasSumrak](https://github.com/NikolasSumrak)

---

Top Contributors

[![NikolasSumrak](https://avatars.githubusercontent.com/u/4971799?v=4)](https://github.com/NikolasSumrak "NikolasSumrak (6 commits)")

---

Tags

phptelegramtelegram bot

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/sumrak-telegram-bot/health.svg)

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

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M2.6k](/packages/craftcms-cms)[cognesy/instructor-php

The complete AI toolkit for PHP: unified LLM API, structured outputs, agents, and coding agent control

310107.9k1](/packages/cognesy-instructor-php)[symfony/ai-platform

PHP library for interacting with AI platform provider.

51927.7k136](/packages/symfony-ai-platform)[symfony/ai-agent

PHP library for building agentic applications.

30536.7k44](/packages/symfony-ai-agent)[spomky-labs/pwa-bundle

Progressive Web App Manifest Generator Bundle for Symfony.

6144.4k1](/packages/spomky-labs-pwa-bundle)[api-platform/symfony

Symfony API Platform integration

323.2M67](/packages/api-platform-symfony)

PHPackages © 2026

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