Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Telegram Bot Bundle

Telegram Bot Bundle Laravel Package

andrew-gos/telegram-bot-bundle

View on GitHub
Deep Wiki
Context7

At a glance

Frequently asked questions about Telegram Bot Bundle
Can I use this bundle directly in Laravel without Symfony, or is it strictly for Symfony projects?
This bundle is designed for Symfony and requires Symfony’s Dependency Injection, HttpKernel, and Flex recipes. To use it in Laravel, you’d need to create a wrapper layer—such as a Laravel service provider—to translate Symfony’s components (e.g., YAML config, console commands) into Laravel’s equivalents. This adds initial setup complexity but is technically feasible.
How do I configure multiple Telegram bots in Laravel using this bundle?
The bundle supports multi-bot setups via YAML config, but in Laravel, you’d replace this with a `config/telegram.php` file. Define each bot under a key (e.g., `bots.my_bot`) with its token, update handlers, and priority-based checkers. Laravel’s service container can then instantiate each bot as a separate service, mirroring the bundle’s architecture.
Does this bundle support webhooks, or is it limited to long-polling for Laravel?
The underlying `andrew-gos/telegram-bot` library supports both webhooks and long-polling. In Laravel, you’d need to configure a route (e.g., `Route::post('/telegram/webhook', ...)`) to handle incoming webhook updates. For production, webhooks are recommended over long-polling to avoid rate limits and improve reliability.
What Laravel versions are compatible with this bundle, and are there PHP version requirements?
The bundle itself requires PHP 8.2+, but Laravel compatibility depends on your wrapper layer. Laravel 10+ (PHP 8.1+) or 11 (PHP 8.2+) would work if you adapt Symfony’s dependencies. The core `andrew-gos/telegram-bot` library (v4.2.0) is PHP 8.2+ strict-typed, so ensure your Laravel app meets these requirements.
How do I handle Telegram bot updates (e.g., messages, commands) in Laravel with this bundle?
Define update handlers in your Laravel config (e.g., `config/telegram.php`) as service classes that implement the bundle’s checker/handler interfaces. Laravel’s service container will instantiate these classes, and the bundle’s event system (translated to Laravel events) will route updates to the appropriate handlers based on priority and message type.
Are there alternatives to this bundle for Laravel that don’t require Symfony dependencies?
Yes. For Laravel, consider `irazasyed/laravel-telegram-bot` (lighter, Laravel-native) or `spatie/laravel-telegram-bot` (more opinionated). These avoid Symfony dependencies but may lack advanced features like strict typing or multi-bot middleware. Choose based on whether you need the bundle’s extensibility or prefer a simpler, Laravel-optimized solution.
How do I integrate this bundle’s console commands (e.g., `telegram:listen`) into Laravel’s Artisan?
You’ll need to register Artisan commands in a Laravel service provider. For example, create a `TelegramServiceProvider` with a `boot()` method that binds the bundle’s commands to Laravel’s Artisan. Replace Symfony’s `bin/console` logic with Laravel’s `Artisan::command()` syntax, ensuring commands like `telegram:listen` work via `php artisan telegram:listen`.
Can I use this bundle in a Laravel queue worker for async bot processing?
Yes, but you’ll need to adapt the bundle’s long-polling or webhook logic to work with Laravel’s queues. For webhooks, ensure your HTTP server (e.g., Valet, Forge) forwards requests to Laravel’s queue worker. For long-polling, dispatch updates as Laravel jobs (e.g., `TelegramUpdateJob`) to process them asynchronously.
What’s the best way to test a Laravel app using this bundle in CI/CD?
Mock Telegram API responses using Laravel’s HTTP testing helpers (e.g., `Http::fake()`) or a testing library like `mockery`. For webhook testing, simulate POST requests to your endpoint with expected payloads. Use Laravel’s `Artisan::call()` to test console commands. Avoid hitting Telegram’s API in tests to prevent rate limits or costs.
Are there performance considerations for running multiple bots in production with this bundle?
The bundle’s architecture is modular, but running multiple bots in Laravel may introduce overhead from Symfony’s DI and event systems. Optimize by: 1) Using Laravel’s caching for bot configurations, 2) Limiting long-polling to non-critical bots, and 3) Offloading heavy processing to Laravel queues. Monitor memory usage, especially if bots handle large media or frequent updates.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
emuniq/filament-browser-notifications
syriable/filament-translator
hungnm28/livewire-form
wenprise/eloquent
crudly/encrypted
fadion/bouncy
cuci/prototurk-sdk
gos/pubsub-router-bundle
cuci/prototurk-sdk-symfony
clementtalleu/easyadmin-markdown-bundle
codeflextech/permission-manager
karnoweb/livewire-datepicker
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui