Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Nutgram Laravel Package

sergix44/nutgram

Nutgram is a modern PHP Telegram bot framework with a Laravel-style API and first-class Laravel integration. Build bots with handlers, middleware, conversations, webhooks, and testable code without boilerplate.

View on GitHub
Deep Wiki
Context7

The Telegram bot framework that doesn't drive you nuts.

Frequently asked questions about Nutgram
How do I install Nutgram in a Laravel application?
Run composer require nutgram/nutgram nutgram/laravel, pinned to a specific version such as 4.50.3. Publish the package config with the vendor publish command so you get config/nutgram.php, then supply your bot token through an environment variable or secret manager rather than committing it to source control. Register the webhook route or use the provided artisan hook command to point Telegram at your application. A sandbox bot can be running in an afternoon since there are no infrastructure dependencies beyond outbound HTTPS and a queue driver for async handlers.
Which PHP and Laravel versions does Nutgram support?
Nutgram is a standalone PHP 8.1+ framework, and the official nutgram/laravel bridge supports Laravel 9, 10, and 11. Before merging, verify the php constraint and the laravel/framework constraint declared by the bridge, and confirm your HTTP client version satisfies the package's PSR-18 requirement. Checking these three constraints up front avoids most Composer resolution surprises during rollout.
How do I set up a Telegram webhook with Nutgram instead of long polling?
Nutgram supports both webhook and long-polling modes. In production you register the webhook route inside your Laravel application and enable the secret-token header check so only Telegram can hit the endpoint; the webhook endpoint is just a normal route, so it does not conflict with your existing routing or middleware. Use long polling only for local development, where you do not have a public HTTPS URL. Keeping the two modes separate prevents accidental polling in production.
Is Nutgram built on the Laravel service container?
No. Nutgram is an independent PHP framework with its own kernel, handler/middleware pipeline, and container; the nutgram/laravel package is an optional bridge that wires it into a Laravel app. Its handler and middleware API feels idiomatic to Laravel developers, but you should treat it as a third-party runtime embedded in your application rather than an extension of Laravel itself. In practice this means no conflicts with Laravel routing or middleware, but also that Laravel-specific features are not automatically available inside Nutgram handlers.
How do I test Nutgram bot handlers?
Put your business logic behind an interface so handlers stay thin and are not coupled to Nutgram's Nutgram class, which makes the logic unit-testable without a bot runtime. Then add contract tests that assert your serialized payloads match the documented Telegram Bot API shapes, and keep them as a permanent regression net against Bot API drift. A staging bot pointed at a dedicated test chat lets you exercise rate limits and duplicate updates before going live.
How do I handle slow operations in a Nutgram bot?
Enable queue-backed handling for anything slower than a few hundred milliseconds so webhook responses stay fast and Telegram does not retry the update. Laravel queues are the natural driver here, since the bridge already lives in your application and you can dispatch jobs from handlers. Keep the handler responsible for parsing the update and pushing work, and let queued jobs do the HTTP calls and persistence.
What changed in Nutgram 4.50.3 and is it a breaking change?
4.50.3 is a patch release with a single change: correcting Bot API type mismatches in media, ephemeral edits, entities, and rich text. No breaking changes are expected, and it should be a drop-in upgrade from 4.50.2 with no application code changes. The one caveat is that if the fix tightens typed properties or constructors on those DTOs, code that depended on lenient coercion may now fail loudly, so run targeted regression tests if you use media uploads, ephemeral edits, entity parsing, or rich text.
How does Nutgram keep up with new Telegram Bot API versions?
Telegram ships Bot API updates frequently, so any bot framework is a moving target by nature, and Nutgram tracks the Bot API closely with regular releases. Patch releases like 4.50.3 that correct Bot API type mismatches are evidence of healthy responsiveness rather than instability. Still, confirm which Bot API version your pinned release targets and whether it is documented, and assign an internal owner for Bot API drift so upgrades do not stall.
Nutgram vs other PHP Telegram bot libraries, how does it compare?
Nutgram's differentiators are a Laravel-style API with first-class Laravel integration, plus handlers, middleware, conversations, webhooks, and testable code without boilerplate. It is a standalone PHP 8.1+ framework with its own kernel rather than a thin wrapper around the Bot API. It is mature and actively maintained, which matters because the Bot API changes often. If you want deep Laravel ergonomics and a modern handler pipeline, it is a strong fit.
Is Nutgram safe to use in production and what are the main risks?
The framework itself is mature and actively maintained, and the integration path is straightforward: Composer install, config publish, token from a secret manager, webhook route with a secret-token header check, and queue-backed async handlers. The main risks are domain-level rather than architectural: Telegram's frequent Bot API updates mean you should pin versions, run a dependency audit, and keep payload contract tests. Also verify that nutgram/laravel ships in lockstep at your pinned version and note the maintainer bus factor, so plan an internal owner for upgrades.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core