Download the PHP package romanlazko/laravel-telegram without Composer
On this page you can find all versions of the php package romanlazko/laravel-telegram. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-telegram
Laravel Telegram Bot Integration
The laravel-telegram package provides a seamless integration between Laravel applications and the Telegram Bot API. It enables developers to easily build Telegram bots with clean, expressive Laravel syntax, and supports features such as:
- Bot creation and registration via Artisan
- Webhook management
- Command-based architecture
- Automatic injection of Telegram update data (Chat, Message, CallbackQuery, etc.)
- Full support for Laravel queues
π Installation
Install the package using Composer:
Optional: Publish Migrations
π€ Create a Bot
Use the following command to register a bot with your Laravel application:
This will generate a new service provider at:
Registering the Provider
Ensure the generated service provider is registered:
- Laravel 11+: in
bootstrap/providers.php - Laravel 10 and below: in
config/app.phpunder theprovidersarray
Add it manually if it was not auto-registered.
π Set the Webhook
To set the Telegram webhook for your bot:
The webhook URL defaults to:
Local Development
Use ngrok to expose your local server:
Then update .env:
Re-run the webhook command after updating the URL.
π¦ Creating Commands
Commands are the main way to handle user interactions with the bot. Each command is a Laravel Job that responds to Telegram updates.
Generate a new command with:
This creates a file at:
β¨ Example Command
π§ Dependency Injection
Your commandβs execute() method can declare parameters like:
UpdateMessageChatCallbackQuery
These will be resolved and injected automatically from the incoming Telegram update.
You can override the method resolveDefaultClosureDependencyForEvaluationByName() to customize how dependencies are resolved.
β Features at a Glance
- [x] Support for multiple bots
- [x] Laravel-native syntax
- [x] Webhook auto-registration
- [x] Commands as Laravel Jobs
- [x] Dependency injection
- [x] Clean architecture
π Resources
π License
This package is open-sourced software licensed under the MIT license.
π¬ Support
Feel free to open issues or contribute with PRs. Happy bot building π€!