andrew-gos/telegram-bot-bundle
events and service providers). The modular, plugin-based architecture mirrors Laravel’s middleware and service provider paradigms.HttpKernel, DependencyInjection, and YAML config). Laravel would require:
andrew_gos_telegram_bot into Laravel’s ServiceProvider/Container APIs..env + config/telegram.php (or a package config file).bin/console commands as Laravel Artisan commands (e.g., php artisan telegram:listen).andrew-gos/telegram-bot library (v4.2.0) provides a clean API, but Laravel’s HTTP client (Guzzle) would need to bridge any low-level differences (e.g., webhook handling).telegram-bot library evolves.^7.3 || ^8.0 may conflict with Laravel’s PHP/extension requirements (e.g., ext-pcntl is optional in Symfony but may be unused in Laravel).Route::post('/telegram/webhook', ...)) would need to integrate with the bundle’s webhook logic, potentially requiring middleware or a custom route service provider.irazasyed/laravel-telegram-bot) may suffice.HttpKernel) may slow adoption.Telegram service to a Laravel service provider).config/telegram.php instead of YAML. Example:
// config/telegram.php
return [
'bots' => [
'my_bot' => [
'token' => env('TELEGRAM_BOT_TOKEN'),
'factory' => 'getUpdates', // or 'default' for webhooks
'handlers' => [
[
'checker' => \App\Telegram\Checker\CommandChecker::class,
'handler' => \App\Telegram\Handler\StartCommandHandler::class,
'priority' => 100,
],
],
],
],
];
// app/Providers/TelegramServiceProvider.php
public function register()
{
$this->app->singleton('telegram.bot.manager', function ($app) {
return new TelegramBotManager($app['config']['telegram']);
});
}
Route::post('/telegram/webhook', function (Request $request) {
return app('telegram.bot.manager')->handleWebhook($request->getContent());
});
php artisan telegram:listen) in a scheduled task (e.g., schedule:run in app/Console/Kernel.php).config/telegram.php./app/Providers/TelegramAdapterServiceProvider.php
/app/Console/Commands/TelegramListenCommand.php
/config/telegram.php
routes/web.php.app()->bind(\App\Telegram\Plugin\RequestLoggerPlugin::class, ...)).config_cache.php) and queue systems.Illuminate\Http\Request/Response.config() helper or a package like spatie/laravel-config-array.Style interface to use Laravel’s Illuminate\Support\Message.andrew-gos/telegram-bot library is API-agnostic, so Laravel’s Guzzle HTTP client can replace Symfony’s HTTP client if needed.http-kernel and replace with Laravel’s illuminate/http.Events, Listeners) instead of Symfony’s EventDispatcher for cross-cutting concerns./start, /help).RequestLoggerPlugin to a Laravel middleware:
public function handle($request, Closure $next)
{
// Log request
return $next($request);
}
symfony/yaml) may not be needed in Laravel, increasing bundle size.HttpKernel and DependencyInjection may make future migrations difficult.How can I help you explore Laravel packages today?