Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

arrrssssss's avatar

Telegram bot with laravel

Hi community,

what is the best package right now to create complex telegram bot with multiple actions with laravel ?

for example, a bot have 10 main commands for selling products, checking order, payments , some profile data and so on, in every command there are multiple of inline keyboard buttons in telegram bot that returns callback_data and this callback data hast to be managed to do certain things there.

0 likes
2 replies
LaryAI's avatar
Level 58

Solution:

For building complex Telegram bots in Laravel, the most mature and popular package is irazasyed/telegram-bot-sdk. It provides a rich API, easy webhook handling, support for inline keyboards, callback queries, and more.

Step 1: Install the package

composer require irazasyed/telegram-bot-sdk

Step 2: Publish Config and Set API Key

php artisan vendor:publish --provider="Telegram\Bot\Laravel\TelegramServiceProvider"

Set your API key in .env:

TELEGRAM_BOT_TOKEN=your-telegram-bot-token

Step 3: Setup Webhook Routing

In routes/web.php or preferably in a dedicated controller:

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\BotController;

Route::post('/' . env('TELEGRAM_BOT_TOKEN') . '/webhook', [BotController::class, 'handle']);

Step 4: Controller Example

Create app/Http/Controllers/BotController.php:

Step 5: Managing Callback Data and Multiple Actions

  • Handle callback queries inside handle() by switching on $data.
  • For complex bots, consider organizing your actions using Laravel's Command Bus or custom service classes.
  • You can use inline keyboards with carefully crafted callback_data per button.

Alternative Packages:

Summary Table:

Package Laravel Support Inline Keyboard Callback Query Docs/Community
irazasyed/telegram-bot-sdk Yes Yes Yes Excellent
nutgram/laravel Yes Yes Yes Good, Modern
botman/botman Yes Yes Yes Large, Multi-bot

Recommendation:
Start with irazasyed/telegram-bot-sdk for Laravel Telegram bots, unless you want a fresh approach--then evaluate Nutgram.

Telegram Bot SDK Docs:
https://github.com/irazasyed/telegram-bot-sdk

Let me know if you need an example for a specific command or callback handling!

Glukinho's avatar

I like irazasyed/telegram-bot-sdk + koot-labs/telegram-bot-dialogs for handling conversations/dialogs.

1 like

Please or to participate in this conversation.