PHPackages                             slavasamsonow/telegram-bot-api - 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. slavasamsonow/telegram-bot-api

ActiveLibrary[API Development](/categories/api)

slavasamsonow/telegram-bot-api
==============================

PHP Telegram Bot API library

v1.7.0(9mo ago)043MITPHPPHP &gt;=8.1

Since Feb 5Pushed 9mo ago1 watchersCompare

[ Source](https://github.com/slavasamsonow/telegram-bot-api)[ Packagist](https://packagist.org/packages/slavasamsonow/telegram-bot-api)[ Docs](https://github.com/slavasamsonow/telegram-bot-api)[ RSS](/packages/slavasamsonow-telegram-bot-api/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (14)Used By (0)

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

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

Extended native php wrapper for [Telegram Bot API](https://core.telegram.org/bots/api) without requirements.

Bots: An introduction for developers
------------------------------------

[](#bots-an-introduction-for-developers)

> You control your bots using HTTPS requests to [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).

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

[](#installation)

### Requirements

[](#requirements)

- PHP 8.1 and higher
- Telegram Bot Token - Talk to [@BotFather](https://t.me/BotFather) and generate one.

### Installation

[](#installation-1)

Via Composer

```
$ composer require slavasamsonow/telegram-bot-api
```

Usage
-----

[](#usage)

### The Basics

[](#the-basics)

#### Before Initialize SDK

[](#before-initialize-sdk)

```
require __DIR__.'/vendor/autoload.php';

use \Slavasamsonow\TelegramBotApi\TelegramBotApi;

$bot = new TelegramBotApi($botToken);
$botInfo = $bot->getMe();
```

#### Send message

[](#send-message)

```
// Create bot
$bot = new TelegramBotApi($botToken);

// Create send message request
$request = new \Slavasamsonow\TelegramBotApi\RequestObjects\SendRequests\SendMessageRequest($chatId, $text);

// Send request
$bot->sendMessage($request);
```

#### Send photo with InputFile

[](#send-photo-with-inputfile)

```
// Create bot
$bot = new TelegramBotApi($botToken);

// Create Input file
$file = file_get_contents($url);
$inputFile = new \Slavasamsonow\TelegramBotApi\InputFile($file);

// Create Send photo request
$request = new \Slavasamsonow\TelegramBotApi\RequestObjects\SendRequests\SendPhotoRequest($id, $inputFile)

// Send request
$bot->sendPhoto($chatId, $document);
```

#### Send message with inline keyboard

[](#send-message-with-inline-keyboard)

```
// Create bot
$bot = new TelegramBotApi($botToken);

// Create inline button
$inlineButton = \Slavasamsonow\TelegramBotApi\RequestObjects\Keyboard\Inline\InlineKeyboardButton::createUrlButton($buttonName, $url);

// Create inline keyboard row
$inlineKeyboardRow = new \Slavasamsonow\TelegramBotApi\RequestObjects\Keyboard\Inline\InlineKeyboardRow([$inlineButton]);

// create inline keyboard
$inlineKeyboard = new \Slavasamsonow\TelegramBotApi\RequestObjects\Keyboard\Inline\InlineKeyboard([$inlineKeyboardRow]);

// Create reply markup
$replyMarkup = new \Slavasamsonow\TelegramBotApi\RequestObjects\Keyboard\Inline\InlineKeyboardMarkup($inlineKeyboard);

// Create send message request
$request = new \Slavasamsonow\TelegramBotApi\RequestObjects\SendRequests\SendMessageRequest($chatId, $text, replyMarkup: $replyMarkup);

// Send request
$bot->sendMessage($request);
```

#### Send media group

[](#send-media-group)

```
// Create bot
$bot = new TelegramBotApi($botToken);

// Create Media
$media = new \Slavasamsonow\TelegramBotApi\RequestObjects\Media\Media();

// Add 1 photo
$media->addPhoto(
    new \Slavasamsonow\TelegramBotApi\RequestObjects\Media\InputMediaPhoto(
        $url1,
        $caption
    )
);

// Add 2 photo
$media->addPhoto(
    new \Slavasamsonow\TelegramBotApi\RequestObjects\Media\InputMediaPhoto(
        $url2
    )
);

// Create send media group request
$request = new \Slavasamsonow\TelegramBotApi\RequestObjects\SendRequests\SendMediaGroupRequest($id, $media);

// send request
$res = $bot->sendMediaGroup($request);
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance58

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

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

Recently: every ~37 days

Total

13

Last Release

275d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/827b0dd37025b3210ddc9197775d497a5777ca30eaf151e2c3b5c6c82a50253d?d=identicon)[slavasamsonow](/maintainers/slavasamsonow)

---

Top Contributors

[![slavasamsonow](https://avatars.githubusercontent.com/u/20429675?v=4)](https://github.com/slavasamsonow "slavasamsonow (24 commits)")

---

Tags

phpapibottelegramtelegram bot api

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[borsaco/telegram-bot-api-bundle

A simple wrapper for telegram-bot-api.

5633.0k](/packages/borsaco-telegram-bot-api-bundle)[telegram-bot-php/core

A PHP library that makes using Telegram Bot API much easier.

60293.1k](/packages/telegram-bot-php-core)[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)[klev-o/crypto-pay-api

Simple and convenient implementation of the Crypto Pay payment system (@CryptoBot)

205.1k](/packages/klev-o-crypto-pay-api)[kuvardin/telegram-bots-api

SDK for Telegram bots API

145.5k](/packages/kuvardin-telegram-bots-api)

PHPackages © 2026

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