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

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

grozzzny/telegram
=================

Telegram module for Yii2

120PHP

Since Aug 23Pushed 4y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Telegram module
===============

[](#telegram-module)

Telegram module for yii2

### Set Webhook

[](#set-webhook)

```
https://api.telegram.org/bot/setWebhook?url=https://site.ru/telegram/

```

### Install

[](#install)

Use module with aki/yii2-bot-telegram

```
$ php composer.phar require grozzzny/telegram "dev-main"
```

### Set log

[](#set-log)

```
'log' => [
  'targets' => [
      [
           'class' => 'yii\log\FileTarget',
           'levels' => ['info'],
           'categories' => ['telegram'],
           'logFile' => '@app/runtime/logs/telegram.log'
      ],
  ],
],
```

### Add module

[](#add-module)

```
'telegram' => [
     'class' => 'grozzzny\telegram\TelegramModule',
     'controllerMap' => [
         'default' => [
             'class'  => 'grozzzny\telegram\controllers\DefaultController',
             'classAction' => 'grozzzny\telegram\components\ExampleAction'
         ]
     ]
],
```

### Add component

[](#add-component)

```
 'telegram' => [
     'class' => 'grozzzny\telegram\components\Telegram',
     'botToken' => '',
     'trace' => false
 ],
```

### Add route:

[](#add-route)

```
'telegram/' => 'telegram/default/index',
```

### Use action:

[](#use-action)

[![alt text](https://raw.githubusercontent.com/grozzzny/telegram/main/2021-08-18_13-51.png)](https://raw.githubusercontent.com/grozzzny/telegram/main/2021-08-18_13-51.png)

```
class ExampleAction extends \grozzzny\telegram\components\TelegramAction
{
    public function bind()
    {
        parent::bind();

        # text interception
        if($this->update->message->text == 'message'){
            Yii::$app->telegram->sendMessage([
                'chat_id' => $this->update->message->chat->id,
                'text' => 'You wrote the word "message"'
            ]);
        };
    }

    # /test
    public function commandTest($param = null)
    {
        $chat_id = $this->update->message->chat->id;

        Yii::$app->telegram->sendMessage([
            'chat_id' => $chat_id,
            'text' => 'Test success!'
        ]);
    }

    # /run
    public function commandRun($param = null)
    {
        $chat_id = $this->update->message->chat->id;

        Yii::$app->telegram->sendMessage([
            'chat_id' => $chat_id,
            'text' => 'Hi! How can I help you?',
            'reply_markup' => self::inlineKeyBoard([[
                [
                    'text' => 'I\'m a button, click on me',
                    'callback_data' => self::encodeCallbackData('answerClick', ['123'])
                ],
            ]])
        ]);
    }

    protected function answerClick($numbers)
    {
        Yii::$app->telegram->answerCallbackQuery(['callback_query_id' => $this->update->callback_query->id]);

        $chat_id = $this->update->callback_query->message->chat->id;

        Yii::$app->telegram->sendMessage([
            'chat_id' => $chat_id,
            'text' => 'The button passed the parameters "'.$numbers.'". Subscribe to the event "your response"',
            'reply_markup' => self::forceReply(),
        ]);

        $this->callbackEvent($chat_id, 'response', [$numbers, '456']);
    }

    protected function response($numbers_1, $numbers_2)
    {
        $chat_id = $this->update->message->chat->id;

        $text = $this->update->message->text;

        Yii::$app->telegram->sendMessage([
            'chat_id' => $chat_id,
            'text' => implode(' ', ['Response:', $numbers_1, $numbers_2, $text])
        ]);
    }
}
```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity29

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/554162fffed79306459e44cdded778e493d695f0229c405b67a717697ab1cc5d?d=identicon)[grozzzny](/maintainers/grozzzny)

---

Top Contributors

[![grozzzny](https://avatars.githubusercontent.com/u/19452327?v=4)](https://github.com/grozzzny "grozzzny (25 commits)")

### Embed Badge

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

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

###  Alternatives

[ampersand/magento2-disable-stock-reservation

This module disables the inventory reservation logic introduced as part of MSI in Magento 2.3.3

2311.5M2](/packages/ampersand-magento2-disable-stock-reservation)[cyclonedx/cyclonedx-php-composer

Creates CycloneDX Software Bill-of-Materials (SBOM) from PHP Composer projects

881.8M83](/packages/cyclonedx-cyclonedx-php-composer)[prestashop/ps_linklist

PrestaShop - Link list

148.3M4](/packages/prestashop-ps-linklist)

PHPackages © 2026

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