PHPackages                             aymericcucherousset/telegram-bot-bundle - 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. aymericcucherousset/telegram-bot-bundle

ActiveSymfony-bundle

aymericcucherousset/telegram-bot-bundle
=======================================

Symfony bundle for Telegram Bot integration

v0.0.1(1w ago)03↓100%MITPHPPHP ^8.4CI passing

Since Mar 13Pushed 1w agoCompare

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

READMEChangelog (1)Dependencies (11)Versions (2)Used By (0)

Telegram Bot Bundle
===================

[](#telegram-bot-bundle)

[![PHP Version](https://camo.githubusercontent.com/6e44ad49e5307c87d1393389feb52ab61c99956e2e5f8c77177b2501f1d3d47f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e342d3838393242462e737667)](https://camo.githubusercontent.com/6e44ad49e5307c87d1393389feb52ab61c99956e2e5f8c77177b2501f1d3d47f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e342d3838393242462e737667)[![License](https://camo.githubusercontent.com/1b15d4499c9d6a0dcd635b4feea73e624b56cd8b3cc039d8f19867b87dda4862/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f61796d657269636375636865726f75737365742f74656c656772616d2d626f74)](https://camo.githubusercontent.com/1b15d4499c9d6a0dcd635b4feea73e624b56cd8b3cc039d8f19867b87dda4862/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f61796d657269636375636865726f75737365742f74656c656772616d2d626f74)[![CI](https://github.com/aymericcucherousset/telegram-bot/actions/workflows/ci.yml/badge.svg)](https://github.com/aymericcucherousset/telegram-bot/actions/workflows/ci.yml/badge.svg)

---

A Symfony bundle for integrating a framework-agnostic Telegram Bot library. Designed for Symfony 7.4 and 8.x, it enables robust, multi-bot support with flexible provider architecture.

Features
--------

[](#features)

- Seamless integration of a framework-agnostic Telegram Bot library into Symfony
- Supports multiple bots and providers via `CompositeBotProvider`
- Built-in `StaticBotProvider` for configuration-based bot definition
- Custom provider support (e.g., database-backed)
- Symfony HttpClient (PSR-18) and nyholm/psr7 (PSR-17) integration
- Webhook controller for Telegram updates
- Automatic handler registration via Symfony service tags
- Symfony 7.4 and 8.x compatibility
- Requires PHP 8.4+

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

[](#installation)

Install via Composer:

```
composer require aymericcucherousset/telegram-bot-bundle
```

Configuration Example
---------------------

[](#configuration-example)

Create `config/packages/telegram_bot.yaml`:

```
telegram_bot:
    bots:
        main:
            token: '%env(TELEGRAM_BOT_TOKEN)%'
```

Create `config/routes/telegram_bot_bundle.yaml`:

```
telegram_bot_bundle:
    resource: '@TelegramBotBundle/config/routes.php'
```

Defining Static Bots
--------------------

[](#defining-static-bots)

Static bots are defined directly in the configuration file:

```
# config/packages/telegram_bot.yaml

telegram_bot:
    bots:
        main:
            token: '%env(TELEGRAM_BOT_TOKEN)%'
```

Creating a Custom DatabaseBotProvider
-------------------------------------

[](#creating-a-custom-databasebotprovider)

Implement the `BotProviderInterface` to fetch bot credentials from a database:

```
