laraxgram/core
Laraxgram Core is a Laravel package for building Telegram bots with a fluent, framework-native API. It handles bot configuration, incoming updates, commands, and handlers while integrating cleanly with Laravel's container and events, so you can ship Telegram integrations quickly using familiar PHP p...
Install the package and publish its config:
composer require laraxgram/core
php artisan vendor:publish --tag=laragram-config
Set the bot token in .env (LARAGRAM_BOT_TOKEN=...) and confirm the service provider is auto-discovered. First place to look is config/laragram.php — v4.5.0 adds several new config blocks (AWS, YAML, AI-SDK, API server binary), and the defaults are conservative enough to leave everything but the token disabled.
Your first use case should be a single webhook endpoint that answers /start. Register the route the package exposes (or point Telegram's setWebhook at your own controller that forwards the update into the bot kernel), then add one handler class for the command. Verify the round trip with php artisan laragram:webhook:info (or the equivalent status command) before touching any of the new integrations — get the token, webhook secret, and one reply working first, then layer on AI-SDK or Citadel.
Webhook-first, queue the rest. The request lifecycle is synchronous; anything that calls an external service (AI-SDK completions, S3 uploads via the AWS manager) belongs in a job dispatched from the handler. This keeps Telegram's webhook timeout from biting you and makes retries free.
Handler-per-command. Keep command classes thin: parse the update, validate, dispatch, reply. Shared logic (formatting, keyboard builders, pagination) goes in small services rather than base classes — the bot kernel resolves handlers from the container, so constructor injection works normally.
FileBag for media. With the FileBag fix in this release, inbound documents/photos now populate predictably. Prefer $request->file('photo')-style access over manual message.photo[-1].file_id digging, and always download to a temporary path before handing off to the AWS manager so you're not streaming between two remote APIs.
Citadel for privileged commands. Use Citadel to gate admin/ops commands rather than hand-rolling a Telegram-ID allowlist. Register it as a middleware on the handler and keep the user↔Telegram-ID mapping in your own table, not in config — config changes require a redeploy and a cache clear.
YAML for flow definitions. With the first-party YAML parser, multi-step conversational flows are now reasonable to express declaratively: define states, prompts, and transitions in a YAML file and have a single generic handler walk the state machine. Keep the YAML schema versioned alongside the code and validate it at boot so a typo fails at deploy, not mid-conversation.
API Server Binary config is the switch for self-hosted Bot API servers (larger upload limits, local file access). Wire it into your deployment via environment variables rather than committing paths, and keep the binary outside the release directory so deployments don't clobber it.
AWS manager replaces ad-hoc S3 clients for media persistence; centralise bucket/prefix/CDN config there so handlers never construct credentials themselves.
update_id.php artisan config:cache will freeze the new config blocks; anything you intend to vary per environment must be read through env() in the config file, not at runtime.on/off/yes booleans, and deeply nested anchors are the usual culprits. Lint flow files in CI and fail the build on schema errors."laraxgram/core": "~4.5.0") until you've exercised the new integrations in staging — this release touches request handling and adds four subsystems at once, which is a lot of surface area for a single patch.How can I help you explore Laravel packages today?