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

ActiveLibrary

leealex/telegram-sdk
====================

Telegram Bot SDK

1.0.46(2w ago)31071MITPHPPHP &gt;=7.2.0CI passing

Since Dec 21Pushed 2w ago1 watchersCompare

[ Source](https://github.com/leealex/telegram-sdk)[ Packagist](https://packagist.org/packages/leealex/telegram-sdk)[ RSS](/packages/leealex-telegram-sdk/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (4)Versions (54)Used By (1)

Telegram Bot API SDK (PHP)
==========================

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

[![Telegram SDK logo](https://user-images.githubusercontent.com/8910097/103632467-2753e480-4f66-11eb-9fe1-2623439a4974.jpg)](https://user-images.githubusercontent.com/8910097/103632467-2753e480-4f66-11eb-9fe1-2623439a4974.jpg)

[![GitHub](https://camo.githubusercontent.com/944beca56cd01e9962837f6f89f936a5edd3d4a0079b4bc49496b0ce537aa76b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6c6565616c65782f74656c656772616d2d73646b3f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/944beca56cd01e9962837f6f89f936a5edd3d4a0079b4bc49496b0ce537aa76b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6c6565616c65782f74656c656772616d2d73646b3f7374796c653d666c61742d737175617265)[![Packagist PHP Version Support](https://camo.githubusercontent.com/1763abf9c5d8f5639fe74b0639f5a2d430f0902dfdea61e489527e519de27861/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6c6565616c65782f74656c656772616d2d73646b3f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/1763abf9c5d8f5639fe74b0639f5a2d430f0902dfdea61e489527e519de27861/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6c6565616c65782f74656c656772616d2d73646b3f7374796c653d666c61742d737175617265)[![GitHub release (latest by date)](https://camo.githubusercontent.com/cda6e3f7afd51e1df677e3fe332776d92c771c66f894f29e00fe2e999458af94/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6c6565616c65782f74656c656772616d2d73646b3f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/cda6e3f7afd51e1df677e3fe332776d92c771c66f894f29e00fe2e999458af94/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6c6565616c65782f74656c656772616d2d73646b3f7374796c653d666c61742d737175617265)[![GitHub repo size](https://camo.githubusercontent.com/8085ff7dd151b827fb230f0f35fdd42821bb3cde41e3efbc2ea5a4be60ec40f2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7265706f2d73697a652f6c6565616c65782f74656c656772616d2d73646b3f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/8085ff7dd151b827fb230f0f35fdd42821bb3cde41e3efbc2ea5a4be60ec40f2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7265706f2d73697a652f6c6565616c65782f74656c656772616d2d73646b3f7374796c653d666c61742d737175617265)[![Packagist Downloads](https://camo.githubusercontent.com/cfa99454ccbaea8f74c5f2630246733359cfa8fb1e685f23198d10908f6d782c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c6565616c65782f74656c656772616d2d73646b3f7374796c653d666c61742d737175617265)](https://packagist.org/packages/leealex/telegram-sdk)[![GitHub last commit](https://camo.githubusercontent.com/e574124e5dae4141c65edd11809639f52b5204cd0c6e55de186e0b2c08d1bb6f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6173742d636f6d6d69742f6c6565616c65782f74656c656772616d2d73646b3f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/e574124e5dae4141c65edd11809639f52b5204cd0c6e55de186e0b2c08d1bb6f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6173742d636f6d6d69742f6c6565616c65782f74656c656772616d2d73646b3f7374796c653d666c61742d737175617265)

About
-----

[](#about)

Telegram Bot API SDK lets you develop Telegram Bots in PHP.

It offers interactions with user by generating inline or custom keyboards.

Please refer to the official documentation

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

[](#installation)

The recommended way to install SDK is through [Composer](https://getcomposer.org/).

```
composer require leealex/telegram-sdk
```

Usage
-----

[](#usage)

```
// Pass your bot's token to the Bot's constructor
$bot = new leealex\telegram\Bot(BOT_TOKEN);
// Optional. Directory path to store DB files at. Default value: sys_get_temp_dir()
$bot->setDb(DB_DIR_PATH);
// Optional. Array of admins IDs
$bot->setAdmins([123456789]);
// Required. Directory path to store all bot's commands
$bot->setCommandsPath(COMMANDS_DIR_PATH);
// Optional. Aliases are primarily used for reply keyboards, which, unlike inline keyboards,
// cannot pass callback queries. Reply keyboard passes the text of the button itself,
// which may contain emoji.
$bot->setCommandsAliases([
    'Button 1️⃣ 🙂' => 'SomeCommand argument1 argument2',
    'Button 2️⃣ 👍' => 'AnotherCommand argument1',
]);
$bot->run();
```

Data storage
------------

[](#data-storage)

SDK uses lightweight NoSQL database [SleekDB](https://sleekdb.github.io/) to store data.

Bot instance holds SleekDB object to interact with database. Use getDb() method to get SleekDB instance.

```
// Get DB
$db = $bot->getDb();
// Fetch data
$user = $db->findBy(['user_id', '=', 123]);
// Fetch data with query builder
$users = $db->createQueryBuilder()
    ->where(['type', '=', 'user'])
    ->orderBy(['age' => 'desc'])
    ->limit(10)
    ->getQuery()
    ->fetch();
// Insert data
$db->insert([
    'type' => 'user',
    'user_id' => 123,
    'username' => 'John',
    'age' => 18
]);
// Update data
$db->createQueryBuilder()
    ->where(['user_id', '=', 123])
    ->getQuery()
    ->update(['age' => 20]);
```

See full documentation at

###  Health Score

48

—

FairBetter than 94% of packages

Maintenance97

Actively maintained with recent releases

Popularity14

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity62

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

Recently: every ~24 days

Total

52

Last Release

14d ago

Major Versions

v0.1.3 → 1.0.02021-01-06

v0.1.4 → 1.0.42021-12-13

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8910097?v=4)[Alexey Lee](/maintainers/leealex)[@leealex](https://github.com/leealex)

---

Top Contributors

[![leealex](https://avatars.githubusercontent.com/u/8910097?v=4)](https://github.com/leealex "leealex (103 commits)")

---

Tags

phptelegram-botstelegram-sdk

### Embed Badge

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

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

###  Alternatives

[neuron-core/neuron-ai

The PHP Agentic Framework.

1.8k245.3k21](/packages/neuron-core-neuron-ai)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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