PHPackages                             mollsoft/laravel-telegram-bot - 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. mollsoft/laravel-telegram-bot

ActiveLibrary[API Development](/categories/api)

mollsoft/laravel-telegram-bot
=============================

This is my package laravel-telegram-bot

v1.1.0(6mo ago)62441MITPHPPHP ^8.3|^8.4CI failing

Since Jul 6Pushed 6mo ago2 watchersCompare

[ Source](https://github.com/mollsoft/laravel-telegram-bot)[ Packagist](https://packagist.org/packages/mollsoft/laravel-telegram-bot)[ Docs](https://github.com/mollsoft/laravel-telegram-bot)[ GitHub Sponsors](https://github.com/Mollsoft)[ RSS](/packages/mollsoft-laravel-telegram-bot/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (11)Versions (103)Used By (0)

Laravel Telegram Bot
====================

[](#laravel-telegram-bot)

[![Latest Version on Packagist](https://camo.githubusercontent.com/7381044e0d6ab1aed1dfc8a731e8c13662bce4dc9feb4a825891bae89ccd9bc6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6f6c6c736f66742f6c61726176656c2d74656c656772616d2d626f742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mollsoft/laravel-telegram-bot)[![GitHub Tests Action Status](https://camo.githubusercontent.com/ae001111bfa13f2f863d4452d35a0be822af1098b56e6c0eb219300ee642aec5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d6f6c6c736f66742f6c61726176656c2d74656c656772616d2d626f742f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/mollsoft/laravel-telegram-bot/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/ad562d2269547fe319a7434c1a54c89cb884f9153f02d31840bcaccfabac295b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d6f6c6c736f66742f6c61726176656c2d74656c656772616d2d626f742f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/mollsoft/laravel-telegram-bot/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/dd8113a06aef1ccd59b763fe0002419a6a0dc40b7d6a2aeba118bc96ee38b819/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6f6c6c736f66742f6c61726176656c2d74656c656772616d2d626f742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mollsoft/laravel-telegram-bot)

EN: This package for Laravel 11+ allows you to easily create interactive Telegram bots, using Laravel routing, and using Blade templates to conduct a dialogue with the user.

RU: Этот пакет для Laravel 11+ позволяет с легкостью создавать интерактивные Telegram боты, при чем использовать маршрутизацию Laravel, а для ведения диалога с пользователем - использовать Blade шаблоны.

Installation / Установка
------------------------

[](#installation--установка)

You can install the package via composer:

Используйте менеджер пакетов Composer для установки пакета:

```
composer require mollsoft/laravel-telegram-bot
```

```
php artisan telegram:install
```

You can publish and run the migrations with:

Вы можете опубликовать и запустить миграции:

```
php artisan vendor:publish --tag="telegram-migrations"
php artisan migrate
```

You can publish the config file with:

Вы можете опубликовать конфигурационные файлы командой:

```
php artisan vendor:publish --tag="telegram-config"
```

Optionally, you can publish the views using:

Опционально, Вы можете опубликовать шаблоны командой:

```
php artisan vendor:publish --tag="telegram-views"
```

Optionally, if you use Sail for local development, you need add PHP params `PHP_CLI_SERVER_WORKERS="10"` in file `supervisord.conf`:

```
[program:php]
command=%(ENV_SUPERVISOR_PHP_COMMAND)s
user=%(ENV_SUPERVISOR_PHP_USER)s
environment=LARAVEL_SAIL="1",PHP_CLI_SERVER_WORKERS="10"
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
```

You can use Laravel Auth, edit file `config/auth.php` and edit section `guards`:

```
'guards' => [
        'web' => [...],
        'telegram' => [
            'driver' => 'telegram',
            'provider' => 'users',
        ]
    ],
```

After this you can use middleware `auth:telegram` in your routes.

If you want work with automatic truncate dialogs, you must run command `php artisan telegram:truncate` every minute using Schedule.

Вы можете настроить "живые страницы", для этого в файле `bootstrap/app.php` в раздел `withMiddleware` добавьте aliase:

```
->withMiddleware(function (Middleware $middleware) {
    $middleware->alias([
        'telegram.live' => \Mollsoft\Telegram\Middleware\LiveMiddleware::class,
    ]);
})
```

После чего в нужном маршруте подключите middleware:

```
Route::telegram('/', [\App\Telegram\Controllers\MyController::class, 'index'])
    ->middleware(['telegram.live:30']);
```

Аргумент - частота в секундах, как часто обновлять страницу.

А в файл `routes/console.php` добавить:

```
Schedule::command('telegram:live')
    ->runInBackground()
    ->everyMinute();
```

Usage / Использование
---------------------

[](#usage--использование)

Create new Telegram Bot:

```
php artisan telegram:new-bot
```

Set Webhook for bot:

```
php artisan telegram:set-webhook
```

Unset Webhook for bot:

```
php artisan telegram:unset-webhook
```

Manual pooling (on localhost) for bot:

```
php artisan telegram:pooling [BOT_ID]
```

### Inline Keyboard

[](#inline-keyboard)

If you want create button for change current URI query params, use this template:

```

        Change query param

```

If you want send POST data you must use this template:

```

        Send field value

```

If you POST data is long, you can encrypt using this template:

```

        Encoded send data

```

If you want make redirect to another page from button, use this template:

```

        Redirect to /

```

### Edit Form / Форма для редактирования данных

[](#edit-form--форма-для-редактирования-данных)

```
class MyForm extends \Mollsoft\Telegram\EditForm\BaseForm
{
    public function rules(): array
    {
        return [
            'name' => ['required', 'string', 'min:5', 'max:255'],
            'phone' => ['required', 'string', 'min:10', 'max:15'],
        ];
    }

    public function titles(): array
    {
        return [
            'name' => 'Ваше имя',
            'phone' => 'Ваш номер телефона'
        ];
    }
}
```

```
class MyController
{
    public function edit(MyForm $form): mixed
    {
        $form->setDefault([
            'name' => 'Default name',
            'phone' => '1234567890',
        ]);

        if( $form->validate() ) {
            // $form->get();
        }

        return view('...', compact('form'));
    }

    public function create(MyForm $form): mixed
    {
        if( $form->isCreate()->validate() ) {
            // $form->get();
        }

        return view('...', compact('form'));
    }
}
```

```

            Please, enter your First Name:

```

Testing / Тестирование
----------------------

[](#testing--тестирование)

```
composer test
```

Ideas / Идеи
------------

[](#ideas--идеи)

1. В Inline Button сделать параметр `query-history=false` что бы по нему текущий URL не сохранялся в referer и при back не выполнялся сброс формы - а был возврат назад.
2. Возможность загрузки пользователями фото/видео/документы и парсинг capture в message.
3. В Reply Button сделать кнопку отправки номера телефона + получение результатов в TelegramRequest.
4. Чтение результата пересланного контакта в TelegramRequest.

Changelog / Логи изменений
--------------------------

[](#changelog--логи-изменений)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Пожалуйста смотрите [CHANGELOG](CHANGELOG.md) для получения подробной информации об изменениях.

Credits / Авторы
----------------

[](#credits--авторы)

- [MollSoft](https://github.com/mollsoft)

License / Лицензия
------------------

[](#license--лицензия)

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

Лицензия MIT (MIT). Дополнительную информацию см. в [Файле лицензии](LICENSE.md).

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance67

Regular maintenance activity

Popularity17

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor1

Top contributor holds 98.3% 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 ~5 days

Recently: every ~38 days

Total

102

Last Release

195d ago

PHP version history (2 changes)v1.0.0-betaPHP ^8.3

v1.0.93PHP ^8.3|^8.4

### Community

Maintainers

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

---

Top Contributors

[![mollsoft](https://avatars.githubusercontent.com/u/151442118?v=4)](https://github.com/mollsoft "mollsoft (116 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

laraveltelegrammollsoftlaravel-telegram-bot

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/mollsoft-laravel-telegram-bot/health.svg)

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

###  Alternatives

[mll-lab/laravel-graphiql

Easily integrate GraphiQL into your Laravel project

683.2M9](/packages/mll-lab-laravel-graphiql)[simplestats-io/laravel-client

Client for SimpleStats!

4515.5k](/packages/simplestats-io-laravel-client)[scalar/laravel

Render your OpenAPI-based API reference

6183.9k2](/packages/scalar-laravel)[ryangjchandler/bearer

Minimalistic token-based authentication for Laravel API endpoints.

8129.8k](/packages/ryangjchandler-bearer)[combindma/laravel-facebook-pixel

Meta pixel integration for Laravel

4956.9k](/packages/combindma-laravel-facebook-pixel)[stechstudio/laravel-hubspot

A Laravel SDK for the HubSpot CRM Api

2971.0k](/packages/stechstudio-laravel-hubspot)

PHPackages © 2026

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