PHPackages                             xbot-my/telegram-sdk - 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. xbot-my/telegram-sdk

ActiveLibrary[API Development](/categories/api)

xbot-my/telegram-sdk
====================

Telegram Bot PHP SDK

1.0.7(3mo ago)0241MITPHPPHP ^8.3CI passing

Since Aug 28Pushed 3mo agoCompare

[ Source](https://github.com/xbot-my/telegram-sdk)[ Packagist](https://packagist.org/packages/xbot-my/telegram-sdk)[ RSS](/packages/xbot-my-telegram-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (8)Dependencies (12)Versions (9)Used By (0)

Telegram Bot PHP SDK
====================

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

An easy-to-use PHP Telegram Bot API SDK providing a high-performance client, semantic endpoints, comprehensive exception handling, and seamless Laravel integration.

---

Features
--------

[](#features)

- Ready to use out of the box
- Comprehensive exception handling
- Fluent chainable calls
- Flexible response transformations

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

[](#installation)

```
composer require xbot-my/telegram-sdk
```

### Laravel

[](#laravel)

```
php artisan vendor:publish --provider="XBot\\Telegram\\Providers\\TelegramServiceProvider"
```

Quick Start
-----------

[](#quick-start)

```
use XBot\\Telegram\\Bot;

$bot = Bot::token('YOUR_BOT_TOKEN');

$me  = $bot->getMe()->toArray();
$msg = $bot->sendMessage(123456789, 'Hello')->toArray();
$bot->setWebhook('https://example.com/telegram/webhook');
```

Webhook and Update Handling
---------------------------

[](#webhook-and-update-handling)

- Set `TELEGRAM_WEBHOOK_SECRET` in your `.env`, and optionally `TELEGRAM_WEBHOOK_ROUTE_PREFIX`.
- The ServiceProvider registers default routes and middleware, validating the `X-Telegram-Bot-Api-Secret-Token` header.
- Implement `UpdateHandler` or extend `BaseUpdateHandler`:

```
class StartHandler extends BaseUpdateHandler {
    protected function onMessage(array $u): void {
        if ($this->text($u) === '/start') $this->replyText($u, 'Welcome!');
    }
}
```

- Command routing can extend `CommandRouter`, e.g., `/start` → `onStart`, `/help foo` → `onHelp`.

Examples
--------

[](#examples)

```
// WebApp
$bot->answerWebAppQuery($queryId, [...]);
// Boosts
$bot->getUserChatBoosts($chatId, $userId);
// Stars
$bot->refundStarPayment($userId, $chargeId);
// Business
$bot->readBusinessMessage($chatId, $messageId);
```

Telegram Bot API 9.2 Parameters
-------------------------------

[](#telegram-bot-api-92-parameters)

- `direct_messages_topic_id`: Send to channel topics
- `suggested_post_parameters`: Suggested posts
- `reply_parameters.checklist_task_id`: Reply to checklist tasks

```
$bot->sendMessage($chatId, 'Hello', ['direct_messages_topic_id' => 1234]);
```

Logging
-------

[](#logging)

- Controlled via environment variables:

    - `TELEGRAM_LOG_ENABLED`
    - `TELEGRAM_LOG_SUPPRESS_INFO`
    - `TELEGRAM_LOG_CHANNEL`
- Events: `telegram.request`, `telegram.response`, `telegram.retry`, etc.

###  Health Score

42

—

FairBetter than 89% of packages

Maintenance86

Actively maintained with recent releases

Popularity7

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 89.2% 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 ~21 days

Recently: every ~0 days

Total

8

Last Release

104d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4e9c51ad711300e5d3648a54d2015000a16bd15d95bbadbf111781d3f709aa5d?d=identicon)[x-multibyte](/maintainers/x-multibyte)

![](https://www.gravatar.com/avatar/22e366ca3ee04fb24740b0c19935d4864221b961d6c41faec048b218e9af86c4?d=identicon)[xbot-my](/maintainers/xbot-my)

---

Top Contributors

[![x-multibyte](https://avatars.githubusercontent.com/u/141466107?v=4)](https://github.com/x-multibyte "x-multibyte (91 commits)")[![xbot-my](https://avatars.githubusercontent.com/u/229084056?v=4)](https://github.com/xbot-my "xbot-my (11 commits)")

---

Tags

laravel-packagephp-librarytelegram

###  Code Quality

TestsPest

Static AnalysisPHPStan

### Embed Badge

![Health badge](/badges/xbot-my-telegram-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/xbot-my-telegram-sdk/health.svg)](https://phpackages.com/packages/xbot-my-telegram-sdk)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M647](/packages/sylius-sylius)[saloonphp/saloon

Build beautiful API integrations and SDKs with Saloon

2.4k9.6M467](/packages/saloonphp-saloon)[theodo-group/llphant

LLPhant is a library to help you build Generative AI applications.

1.5k311.5k5](/packages/theodo-group-llphant)[googleads/googleads-php-lib

Google Ad Manager SOAP API Client Library for PHP

67410.3M25](/packages/googleads-googleads-php-lib)[yoti/yoti-php-sdk

Yoti SDK for quickly integrating your PHP backend with Yoti

27539.9k1](/packages/yoti-yoti-php-sdk)[php-heroku-client/php-heroku-client

A PHP client for the Heroku Platform API

24404.8k4](/packages/php-heroku-client-php-heroku-client)

PHPackages © 2026

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