Download the PHP package mk4u/larabot without Composer
On this page you can find all versions of the php package mk4u/larabot. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package larabot
LaraBot
Seamless integration of TGram the powerful PHP library for creating Telegram bots with the Laravel framework.
🚀 Features
- Artisan Commands: Use TGram through familiar Laravel commands
- Laravel Cache Integration: Automatic PSR-16 adapter
- Laravel Configuration: Native Laravel configuration system
- Dependency Injection: Type-hint Bot in controllers for automatic injection
- Service Container: Bot registered as singleton in Laravel container
- Webhook Management: Easy webhook configuration for Telegram bots
📦 Installation
⚡ Quick Start
1. Install and Configure
This command will:
- Configure the Laravel API (Sanctum)
- Publish the TGram configuration
- Create bot directory structure (commands, callbacks, middlewares)
- Create default command classes (Start, Help)
- Generate middleware configuration
2. Configure your Bot
Add to your .env file:
3. Register default commands and callback functions
4. Configure Webhook
5. Create Your Commands
🛠 Available Commands
| Command | Description |
|---|---|
php artisan tgram |
Install and configure TGram |
php artisan tgram:register |
Register all commands and callbacks |
php artisan tgram:hook:set <url> |
Set webhook URL |
php artisan tgram:hook:delete |
Delete webhook |
php artisan tgram:hook:info |
Get webhook info |
php artisan tgram:hook:about |
Get bot info |
php artisan tgram:poll <interval> |
Start long polling |
php artisan tgram:command <name> |
Create new command |
php artisan tgram:callback <name> <action> |
Create new callback handler |
php artisan tgram:conversation <name> |
Create new conversation |
php artisan tgram:handler <name> |
Create new handler |
php artisan tgram:middleware <name> |
Create new middleware |
⚙️ Settings
After installation, add to your .env:
Parameter descriptions:
- BOT_TOKEN — Your Telegram bot token (issued by @BotFather). Required.
- BOT_SECRET — Secret token to verify webhook authenticity (
X-Telegram-Bot-Api-Secret-Tokenheader). Optional but recommended. - BOT_MANAGERS — Telegram user IDs of bot administrators, comma-separated. Enables the
isAdmin()method to restrict commands. Optional.
🌐 Webhook Route
Add to your routes/api.php:
🔧 Dependency Injection
Type-hinting in Controllers
The Bot is registered as a singleton in Laravel's service container. You can inject it directly:
Using the Service Container
Note: Always use
app('tgram')orapp(Bot::class)instead ofnew Bot(...). The singleton handles Laravel cache integration automatically.
Using Facade (if needed)
Create a Facade in your Laravel app app/Facades/Bot.php:
Then use: Bot::sendMessage([...])
🎯 Usage Examples
Send a Message
Send with Keyboard
Answer Callback Query
📚 Requirements
- PHP 8.5+
- Laravel 13.x+
- TGram Library (automatically installed)
🆘 Support
📄 License
MIT License - see the LICENSE file for details.
Need help? Open an issue on GitHub or consult the TGram documentation.
All versions of larabot with dependencies
mk4u/tgram Version ^0.1
al3x5/laravel-psr16-cache Version ^1.0
illuminate/console Version ^13.0
illuminate/support Version ^13.0