PHPackages                             opensourcewebsite-org/php-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. opensourcewebsite-org/php-telegram-sdk

ActiveLibrary[API Development](/categories/api)

opensourcewebsite-org/php-telegram-sdk
======================================

Telegram Bot API library for the PHP language

v2.3.22(5y ago)33.2k↓45.5%2[1 issues](https://github.com/opensourcewebsite-org/php-telegram-sdk/issues)MITPHPPHP &gt;=5.5.0

Since Jun 29Pushed 1y ago2 watchersCompare

[ Source](https://github.com/opensourcewebsite-org/php-telegram-sdk)[ Packagist](https://packagist.org/packages/opensourcewebsite-org/php-telegram-sdk)[ Docs](https://github.com/TelegramBot/Api)[ RSS](/packages/opensourcewebsite-org-php-telegram-sdk/feed)WikiDiscussions master Synced 1mo ago

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

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

[](#php-telegram-sdk)

[![License](https://camo.githubusercontent.com/c2bffd81d308ced1cc3b0d66fb0ed453ab478a5e17c988b780f9de986a390ee2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![PHP Version](https://camo.githubusercontent.com/7d542d7725082b04fea064962e5c2915bf2631e102b531aee9650e1a536184d3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d372e342d626c75652e7376673f7374796c653d666c61742d737175617265266c6f676f3d706870)](https://www.php.net)

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 [Telegram 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).

PHP Telegram SDK for the [Telegram Bot API](https://core.telegram.org/bots/api).

This library is under active development and should be considered beta quality. Please ensure that you've tested extensively on a test network and have added sanity checks in other places in your code.

The repository is a part of the [OpenSourceWebsite Organization](https://github.com/opensourcewebsite-org). This project and everyone participating in it is governed by the [Code of Conduct](CODE_OF_CONDUCT.md).

Getting Started
---------------

[](#getting-started)

[See the release notes for breaking changes](CHANGELOG.md).

Please read through [Telegram Bot API Documentation](https://core.telegram.org/bots/api).

Contributing
------------

[](#contributing)

Please read through our [Contribution Guidelines](CONTRIBUTING.md).

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
composer require opensourcewebsite-org/php-telegram-sdk

```

or add

```
"opensourcewebsite-org/php-telegram-sdk": "*"

```

to the require section of your `composer.json` file.

Usage
-----

[](#usage)

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

Tests
-----

[](#tests)

```
$ composer test
```

Feedback
--------

[](#feedback)

To request a new feature, submit a bug report, give us feedback, start a design discussion or have an idea to make this code better feel free to [open an issue](https://github.com/opensourcewebsite-org/php-telegram-sdk/issues), or [create a pull request](https://github.com/opensourcewebsite-org/php-telegram-sdk/pulls).

Please send all security issues to .

License
-------

[](#license)

This project is open source and available freely under the [MIT license](LICENSE.md).

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community23

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 54.7% 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 ~48 days

Recently: every ~14 days

Total

44

Last Release

1897d ago

Major Versions

v1.2.3 → v2.0.02015-08-21

v2.3.13 → 3.0.0.x-dev2019-12-18

v2.3.21 → 3.1.0.x-dev2021-03-09

PHP version history (5 changes)v1.0.0PHP &gt;=5.3.0

v2.0.0PHP &gt;=5.4.0

v2.2.0PHP &gt;=5.5.0

3.0.0.x-devPHP ^7.2

3.1.0.x-devPHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/f9d833b8c4a8c06e6689eb7017ebf2fcf5cbad52c4e71211932af0361a0d06d2?d=identicon)[grandmotivator](/maintainers/grandmotivator)

---

Top Contributors

[![iGusev](https://avatars.githubusercontent.com/u/1555767?v=4)](https://github.com/iGusev "iGusev (342 commits)")[![bakteriachan](https://avatars.githubusercontent.com/u/91647291?v=4)](https://github.com/bakteriachan "bakteriachan (93 commits)")[![grandmotivator](https://avatars.githubusercontent.com/u/34159182?v=4)](https://github.com/grandmotivator "grandmotivator (69 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)")[![wintersakuraa](https://avatars.githubusercontent.com/u/97823692?v=4)](https://github.com/wintersakuraa "wintersakuraa (11 commits)")[![francis22](https://avatars.githubusercontent.com/u/1169138?v=4)](https://github.com/francis22 "francis22 (11 commits)")[![uc-itcom](https://avatars.githubusercontent.com/u/21470696?v=4)](https://github.com/uc-itcom "uc-itcom (9 commits)")[![lopatinas](https://avatars.githubusercontent.com/u/4607426?v=4)](https://github.com/lopatinas "lopatinas (5 commits)")[![POPSuL](https://avatars.githubusercontent.com/u/683358?v=4)](https://github.com/POPSuL "POPSuL (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)")[![BoShurik](https://avatars.githubusercontent.com/u/1428848?v=4)](https://github.com/BoShurik "BoShurik (3 commits)")[![nikserg](https://avatars.githubusercontent.com/u/5680589?v=4)](https://github.com/nikserg "nikserg (2 commits)")[![SergeAx](https://avatars.githubusercontent.com/u/3264530?v=4)](https://github.com/SergeAx "SergeAx (2 commits)")[![Julielesss](https://avatars.githubusercontent.com/u/36435376?v=4)](https://github.com/Julielesss "Julielesss (1 commits)")[![palehin](https://avatars.githubusercontent.com/u/14148595?v=4)](https://github.com/palehin "palehin (1 commits)")[![pembrock](https://avatars.githubusercontent.com/u/1942441?v=4)](https://github.com/pembrock "pembrock (1 commits)")[![gilberg-vrn](https://avatars.githubusercontent.com/u/11310253?v=4)](https://github.com/gilberg-vrn "gilberg-vrn (1 commits)")

---

Tags

apibotbot-apihacktoberfestphpphp7sdktelegramtelegram-bottelegram-bot-apiphpbottelegrambot api

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/opensourcewebsite-org-php-telegram-sdk/health.svg)

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

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