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

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

panix/mod-telegram
==================

Support chat for site based on Telegram bot

031

Since Aug 24Compare

[ Source](https://github.com/andrtechno/mod-telegram)[ Packagist](https://packagist.org/packages/panix/mod-telegram)[ RSS](/packages/panix-mod-telegram/feed)WikiDiscussions Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

**Telegram support Bot for Yii2**
=================================

[](#telegram-support-bot-for-yii2)

[![Latest Stable Version](https://camo.githubusercontent.com/71224805ec7a569af06c30173c3bbe3b704fe3f14769c718f25f67183e43c6da/68747470733a2f2f706f7365722e707567782e6f72672f70616e69782f6d6f642d74656c656772616d2f762f737461626c65)](https://packagist.org/packages/panix/mod-telegram)[![Total Downloads](https://camo.githubusercontent.com/368582c16b27d9ca4753617fe7d4680d4b11f70758ecb5e2cb6cb3a3379f25c5/68747470733a2f2f706f7365722e707567782e6f72672f70616e69782f6d6f642d74656c656772616d2f646f776e6c6f616473)](https://packagist.org/packages/panix/mod-telegram)[![License](https://camo.githubusercontent.com/228563944b9a27a549817abb495bd17162909103106b5804ee8dcb5c4ea029bb/68747470733a2f2f706f7365722e707567782e6f72672f70616e69782f6d6f642d74656c656772616d2f6c6963656e7365)](https://packagist.org/packages/panix/mod-telegram)[![Daily Downloads](https://camo.githubusercontent.com/57a2dd6d64488b1d853f5e2f31861778c94425877592d5ad7b9e1daab666027f/68747470733a2f2f706f7365722e707567782e6f72672f70616e69782f6d6f642d74656c656772616d2f642f6461696c79)](https://packagist.org/packages/panix/mod-telegram)[![Monthly Downloads](https://camo.githubusercontent.com/477347f71dcdf1fcedabd0d4713581c125305e78051f43a7f71f1864f6cbc470/68747470733a2f2f706f7365722e707567782e6f72672f70616e69782f6d6f642d74656c656772616d2f642f6d6f6e74686c79)](https://packagist.org/packages/panix/mod-telegram)

**Support chat for site based on Telegram bot**

The Bot logic based on [akalongman/php-telegram-bot](https://github.com/akalongman/php-telegram-bot), so you can read Instructions by longman how to register Telegram Bot and etc.

***Now only telegram webhook api support. You need SSL cert! Doesn't work on http!***

**Installation**
----------------

[](#installation)

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

Run

```
composer require panix/mod-telegram

```

add to your web config:

```
 'modules' => [
     //...
    'telegram' => [
        'class' => 'panix\mod\telegram\Module',
        'API_KEY' => 'forexample241875489:AdfgdfFuVJdsKa1cycuxra36g4dfgt66',
        'BOT_NAME' => 'YourBotName_bot',
        'hook_url' => 'https://yourhost.com/telegram/default/hook', // must be https! (if not prettyUrl https://yourhost.com/index.php?r=telegram/default/hook)
        'PASSPHRASE' => 'passphrase for login',
        // 'db' => 'db2', //db file name from config dir
        // 'userCommandsPath' => '@app/modules/telegram/UserCommands',
        // 'timeBeforeResetChatHandler' => 60
    ]
    //more...
 ]

```

and to console config:

```
 'bootstrap' => [
 //other bootstrap components...
                'telegram'],
 'modules' => [
         //...
     'telegram' => [
         'class' => 'panix\mod\telegram\Module',
         'API_KEY' => 'forexample241875489:AdfgdfFuVJdsKa1cycuxra36g4dfgt66',
         'BOT_NAME' => 'YourBotName_bot',
     'hook_url' => 'https://yourhost.com/telegram/default/hook', // must be https! (if not prettyUrl https://yourhost.com/index.php?r=telegram/default/hook)
         'PASSPHRASE' => 'passphrase for login',
     ]
 ],

```

run migrations:

```
php yii migrate --migrationPath=@vendor/onmotion/yii2-telegram/migrations #that add 4 tables in your DB

```

or add to your config file

```
'controllerMap' => [
    ...
    'migrate' => [
        'class' => 'yii\console\controllers\MigrateController',
        'migrationNamespaces' => [
            'panix\mod\telegram\migrations',
        ],
    ],
    ...
],

```

and run

```
php yii migrate/up

```

go to  (if not prettyUrl )

Now you can place where you want

```
echo \panix\mod\telegram\TelegramWidget::widget(); //that add chat button in the page

```

in bottom right corner you can see:

[![chat button](https://github.com/panix/mod-telegram/raw/wiki/_wiki/04.png?raw=true)](https://github.com/panix/mod-telegram/blob/wiki/_wiki/04.png?raw=true)

if you click it:

[![client chat](https://github.com/panix/mod-telegram/raw/wiki/_wiki/03.png?raw=true)](https://github.com/panix/mod-telegram/blob/wiki/_wiki/03.png?raw=true)

and server side:

[![client chat](https://github.com/panix/mod-telegram/raw/wiki/_wiki/02.png?raw=true)](https://github.com/panix/mod-telegram/blob/wiki/_wiki/02.png?raw=true)

If you want to limit the storage period of messages history, add to you crontab:

```
#leave 5 days (if empty - default = 7)
php yii telegram/messages/clean 5

```

Also you can use custom commands. To do this, you can copy UserCommands dir from /vendor/panix/mod-telegram/Commands and add path to this in config, for example:

```
'userCommandsPath' => '@app/modules/telegram/UserCommands'

```

**timeBeforeResetChatHandler** - the number of minutes before chat handler will be killed (if he forgot do /leavedialog). Never kill if 0 or not setted.

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

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/f081670109ead0bd6a80aa3af5e9ef9fdcacecdaa3d5a9c1281eed523d09e455?d=identicon)[andrtechno](/maintainers/andrtechno)

### Embed Badge

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

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

PHPackages © 2026

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