PHPackages                             uzdevid/php-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. uzdevid/php-telegram-bot

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

uzdevid/php-telegram-bot
========================

Telegram messenjerida bot yaratish uchun PHP kutubxonasi

3.0.0(1y ago)3554MITPHPPHP &gt;=8.2CI failing

Since Nov 18Pushed 1w agoCompare

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

READMEChangelogDependencies (3)Versions (7)Used By (0)

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

[](#php-telegram-bot)

A comprehensive PHP library for building Telegram bots with complete Telegram Bot API support.

Features
--------

[](#features)

- ✨ **Complete API Coverage**: All 185+ Telegram Bot API methods
- 📝 **Comprehensive Documentation**: Full PHPDoc for every method
- 🏗️ **Builder Pattern**: Fluent interface for method chaining
- 🔍 **Static Analysis**: Integrated linting (PHP\_CodeSniffer, PHPStan, PHP-CS-Fixer)
- ⚡ **Type-Safe**: Strict types and full type hints
- 🎯 **PSR-12 Compliant**: Follows PHP Standards Recommendations

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

[](#installation)

```
composer require "uzdevid/php-telegram-bot"
```

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

[](#quick-start)

### Sending a Message

[](#sending-a-message)

```
use UzDevid\Telegram\Bot\Client;
use UzDevid\Telegram\Bot\Config\ClientConfig;
use UzDevid\Telegram\Bot\Message\Message\Method\SendMessage;
use GuzzleHttp\Client as HttpClient;

$config = new ClientConfig('YOUR_BOT_TOKEN');
$httpClient = new HttpClient();
$bot = new Client($config, $httpClient);

$message = new SendMessage('Hello, World!');
$message->parseMode('HTML');

$response = $bot
    ->withChatId(123456789)
    ->withMethod($message)
    ->send();
```

### Handling Updates

[](#handling-updates)

```
use UzDevid\Telegram\Bot\Server;
use UzDevid\Telegram\Bot\Handler\MessageHandlerInterface;
use UzDevid\Telegram\Bot\Update\MessageUpdate;
use Yiisoft\Hydrator\Hydrator;

class StartMessageHandler implements MessageHandlerInterface {
    public function canHandle(MessageUpdate $update): bool {
        return $update->message->text === '/start';
    }

    public function handle(MessageUpdate $update): void {
        // Handle the message
    }
}

$server = new Server($container, new Hydrator());
$payload = json_decode(file_get_contents('php://input'), true);

$server
    ->withPayload($payload)
    ->onMessage(StartMessageHandler::class);
```

### Storing User State

[](#storing-user-state)

`UzDevid\Telegram\Bot\State\StateStorageInterface` lets you persist per-user state (e.g. a registration flow step) behind a pluggable interface — implement it on top of a session, cache, database, etc. A ready-to-use `SessionStateStorage` implementation is included.

```
use UzDevid\Telegram\Bot\State\SessionStateStorage;

$state = new SessionStateStorage();
$state->set('user:123:registration:step', 'awaiting_phone');

if ($state->has('user:123:registration:step')) {
    $step = $state->get('user:123:registration:step');
}

$state->delete('user:123:registration:step');
```

See **[Storing User State](docs/en/use-state.md)** for details and custom implementation examples.

Documentation
-------------

[](#documentation)

Complete documentation is available in the `docs/` directory, organized by language:

- **[English](docs/en/index.md)** (default)
- **[Русский](docs/ru/index.md)**
- **[O'zbekcha](docs/uz/index.md)**

Each language folder contains:

- **Installation &amp; Configuration** - Setup and bot token configuration
- **Using the Client** - Sending messages and making API calls
- **Using the Server** - Handling incoming updates
- **API Methods** - List of all 185+ available methods
- **Examples** - Real-world code examples
- **Contributing** - How to contribute
- **FAQ** - Frequently asked questions

Code Quality
------------

[](#code-quality)

```
# Run all static analysis checks
composer static-analysis

# Individual checks
composer phpcs      # PHP_CodeSniffer
composer phpstan   # PHPStan type checker
composer lint      # PHP-CS-Fixer dry-run
composer lint:fix  # PHP-CS-Fixer apply fixes
```

License
-------

[](#license)

MIT License - See LICENSE file for details

Author
------

[](#author)

Ibragimov Diyorbek ()

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance75

Regular maintenance activity

Popularity21

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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 ~193 days

Total

4

Last Release

422d ago

Major Versions

1.0.1 → 2.0.02025-06-20

2.0.0 → 3.0.02025-06-21

PHP version history (2 changes)1.0.0PHP &gt;=8.0

2.0.0PHP &gt;=8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/104216283?v=4)[UzDevid](/maintainers/uzdevid)[@uzdevid](https://github.com/uzdevid)

---

Top Contributors

[![DikoIbragimov](https://avatars.githubusercontent.com/u/167644693?v=4)](https://github.com/DikoIbragimov "DikoIbragimov (63 commits)")

---

Tags

phpextensionbottelegram

### Embed Badge

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

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

###  Alternatives

[laravel/framework

The Laravel Framework.

34.9k556.2M21.4k](/packages/laravel-framework)[tempest/framework

The PHP framework that gets out of your way.

2.3k37.6k21](/packages/tempest-framework)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

762297.9k53](/packages/civicrm-civicrm-core)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6943.5M449](/packages/drupal-core-recommended)[ecotone/ecotone

Enterprise architecture layer for Laravel and Symfony — CQRS, Event Sourcing, Durable Workflows (Sagas, Orchestrators), Projections, and Outbox messaging via PHP attributes.

568591.1k63](/packages/ecotone-ecotone)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

353.6k](/packages/eslazarev-wildberries-sdk)

PHPackages © 2026

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