PHPackages                             abdullajonov-lab/nutgram-admin-panel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Admin Panels](/categories/admin)
4. /
5. abdullajonov-lab/nutgram-admin-panel

ActiveLibrary[Admin Panels](/categories/admin)

abdullajonov-lab/nutgram-admin-panel
====================================

FilamentPHP admin panel plugin for Telegram bot management with Nutgram

v2.0.0(1mo ago)10MITPHPPHP ^8.2

Since Dec 25Pushed 1mo agoCompare

[ Source](https://github.com/abdullajonov-lab/ngap)[ Packagist](https://packagist.org/packages/abdullajonov-lab/nutgram-admin-panel)[ RSS](/packages/abdullajonov-lab-nutgram-admin-panel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (8)Versions (4)Used By (0)

Nutgram Admin Panel
===================

[](#nutgram-admin-panel)

A [FilamentPHP](https://filamentphp.com) plugin that provides a full-featured admin panel for managing Telegram bots built with [Nutgram](https://github.com/nutgram/nutgram).

Features
--------

[](#features)

- **User Tracking** — Automatically tracks bot users (name, username, language, status, last activity)
- **Channel Management** — Add channels/groups, enforce mandatory join before bot usage, sync member counts
- **Admin Management** — Manage bot administrators with role-based access (Admin / Super Admin)
- **Broadcast System** — Send messages to all active users with rate limiting, progress tracking, and cancellation
- **Statistics Dashboard** — Real-time stats with charts for user growth, retention, broadcast delivery, and channel membership

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 11 or 12
- FilamentPHP 3.x
- [nutgram/laravel](https://github.com/nutgram/laravel) 1.6+
- Redis (required for broadcast rate limiting)
- A queue worker (for broadcasts)

Installation
------------

[](#installation)

```
composer require abdullajonov-lab/nutgram-admin-panel
```

Run the migrations:

```
php artisan migrate
```

### Register the Plugin

[](#register-the-plugin)

Add the plugin to your Filament panel provider (e.g. `app/Providers/Filament/AdminPanelProvider.php`):

```
use AbdullajonovLab\NutgramAdminPanel\NutgramAdminPanelPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->plugins([
            NutgramAdminPanelPlugin::make(),
        ]);
}
```

> **Important:** Use `->plugins([...])` (plural, array), not `->plugin(...)`.

### Remove Default Dashboard (Recommended)

[](#remove-default-dashboard-recommended)

The plugin registers a Statistics page as the landing page (`/`). To avoid route conflicts, remove the default Filament dashboard:

```
use Filament\Pages\Dashboard;

public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->pages([
            // Remove Dashboard::class or leave empty
        ])
        ->plugins([
            NutgramAdminPanelPlugin::make(),
        ]);
}
```

Configuration
-------------

[](#configuration)

Publish the config file:

```
php artisan vendor:publish --tag=nutgram-admin-panel-config
```

```
// config/nutgram-admin-panel.php

return [
    // Customize table names to avoid conflicts
    'table_names' => [
        'bot_users'  => 'nutgram_bot_users',
        'channels'   => 'nutgram_channels',
        'broadcasts' => 'nutgram_broadcasts',
        'admins'     => 'nutgram_admins',
    ],

    'broadcast' => [
        'queue'      => env('NUTGRAM_BROADCAST_QUEUE', 'default'),
        'rate_limit' => 25, // messages/second (Telegram limit ~30)
        'max_tries'  => 3,
    ],

    'channel_check' => [
        'enabled'   => true,
        'cache_ttl' => 300, // seconds
    ],
];
```

Telegram Bot Routes
-------------------

[](#telegram-bot-routes)

The package registers default bot routes (middleware, handlers, and basic commands). To customize them, publish the route file:

```
php artisan vendor:publish --tag=nutgram-admin-panel-routes
```

This creates `routes/telegram.php` in your project. The package will use your published file instead of the default one.

The default routes include:

```
// Middleware (runs on every update)
$bot->middleware(PersistUserMiddleware::class);   // Tracks users
$bot->middleware(ChannelJoinMiddleware::class);   // Enforces mandatory channel join

// Handler for "Check membership" button
$bot->onCallbackQueryData('check_membership', CheckMembershipHandler::class);

// Default commands
$bot->onCommand('start', fn (Nutgram $bot) => $bot->sendMessage('Welcome!'));
$bot->onCommand('help', fn (Nutgram $bot) => $bot->sendMessage('...'));
$bot->fallback(fn (Nutgram $bot) => $bot->sendMessage('Try /help'));
```

Usage
-----

[](#usage)

### User Tracking

[](#user-tracking)

User tracking is automatic. The `PersistUserMiddleware` runs on every bot update and saves/updates user data in the `nutgram_bot_users` table.

Tracked fields:

- `telegram_id`, `first_name`, `last_name`, `username`, `language_code`
- `status` — `active`, `blocked`, or `deactivated`
- `last_activity_at` — updated on every interaction

Users are listed in the admin panel under **Bot Management &gt; Bot Users** (read-only).

### Channel Management

[](#channel-management)

#### Adding a Channel

[](#adding-a-channel)

1. Go to **Bot Management &gt; Channels &gt; Create**
2. Enter the channel's `chat_id` (numeric, e.g. `-1001234567890`) or `@username`
3. The bot will validate it has admin access to the channel
4. Toggle **Is Mandatory** to enforce joining before bot usage
5. Toggle **Is Active** to enable/disable the channel

> The bot must be an **administrator** in the channel for validation and membership checks to work.

#### Mandatory Join Flow

[](#mandatory-join-flow)

When `channel_check.enabled` is `true`:

1. User sends a message to the bot
2. `ChannelJoinMiddleware` checks if the user is a member of all mandatory channels
3. If not, the bot sends a prompt with join links and a "Check membership" button
4. User joins the channels and presses "Check membership"
5. If verified, the prompt is deleted and the bot processes normally

Membership results are cached for `cache_ttl` seconds (default: 5 minutes).

### Admin Management

[](#admin-management)

Go to **Bot Management &gt; Admins** to manage bot administrators.

Fields:

- `telegram_id` — The admin's Telegram user ID
- `name` — Display name
- `role` — `admin` or `super_admin`

The last remaining admin cannot be deleted (safety check).

### Broadcasts

[](#broadcasts)

#### Sending a Broadcast

[](#sending-a-broadcast)

1. Go to **Bot Management &gt; Broadcasts &gt; Create**
2. Write your message (HTML formatting supported)
3. Submit — the broadcast is queued and sent to all active users

#### Broadcast Lifecycle

[](#broadcast-lifecycle)

StatusDescription`pending`Created, waiting for queue worker`sending`Currently delivering messages`completed`All messages sent`cancelled`Manually cancelled during sending`failed`Failed to completeThe broadcast list auto-refreshes every 5 seconds so you can monitor progress in real time. You can cancel a broadcast while it's `sending`.

#### Queue Worker

[](#queue-worker)

Broadcasts require a running queue worker:

```
php artisan queue:work --queue=default
```

Or if you configured a custom queue:

```
php artisan queue:work --queue=broadcasts
```

### Statistics Dashboard

[](#statistics-dashboard)

The landing page shows 5 widgets:

1. **Bot Stats Overview** — Total users, active users, blocked users, total broadcasts (refreshes every 10s)
2. **User Growth Chart** — Line chart with week/month/year filters (30s refresh)
3. **User Retention Chart** — Returning users over time, line chart (30s refresh)
4. **Broadcast Delivery Chart** — Stacked bar chart showing sent/failed/blocked per broadcast (30s refresh)
5. **Channel Membership Chart** — Horizontal bar chart comparing member counts across channels (30s refresh)

Customizing Services
--------------------

[](#customizing-services)

All services are bound to interfaces in the container. You can swap any implementation:

```
use AbdullajonovLab\NutgramAdminPanel\Contracts\ChannelServiceInterface;
use App\Services\MyCustomChannelService;

// In a service provider
$this->app->bind(ChannelServiceInterface::class, MyCustomChannelService::class);
```

Available interfaces:

InterfaceDefault ImplementationPurpose`TelegramUserServiceInterface``TelegramUserService`User persistence and status`ChannelServiceInterface``ChannelService`Channel validation and membership`BroadcastServiceInterface``BroadcastService`Broadcast creation and delivery`StatisticsServiceInterface``StatisticsService`Dashboard data aggregationTranslations
------------

[](#translations)

The package supports localization. Publish the translation files:

```
php artisan vendor:publish --tag=nutgram-admin-panel-translations
```

Translation files are organized by feature: `user.php`, `channel.php`, `admin.php`, `broadcast.php`, `statistics.php`, `general.php`.

Running the Bot
---------------

[](#running-the-bot)

### Polling (Development)

[](#polling-development)

```
php artisan nutgram:run
```

### Webhook (Production)

[](#webhook-production)

```
php artisan nutgram:hook:set https://your-domain.com/webhook
```

See the [Nutgram Laravel documentation](https://github.com/nutgram/laravel) for more details.

Testing
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

MIT

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance89

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~40 days

Total

3

Last Release

57d ago

Major Versions

v1.0.1 → v2.0.02026-03-16

### Community

Maintainers

![](https://www.gravatar.com/avatar/3724cdac9283e9d4212c132a574be205511b4814b90c6abaadaa9f0cf30d61aa?d=identicon)[foxdevuz](/maintainers/foxdevuz)

---

Top Contributors

[![foxdevuz](https://avatars.githubusercontent.com/u/86303222?v=4)](https://github.com/foxdevuz "foxdevuz (1 commits)")

---

Tags

admin-panelbotnutgramphptelegram-botlaraveltelegramfilamentadmin-panelnutgramBroadcast

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/abdullajonov-lab-nutgram-admin-panel/health.svg)

```
[![Health](https://phpackages.com/badges/abdullajonov-lab-nutgram-admin-panel/health.svg)](https://phpackages.com/packages/abdullajonov-lab-nutgram-admin-panel)
```

###  Alternatives

[awcodes/filament-quick-create

Plugin for Filament Admin that adds a dropdown menu to the header to quickly create new items.

246177.6k7](/packages/awcodes-filament-quick-create)[a2insights/filament-saas

Filament Saas for A2Insights

161.1k](/packages/a2insights-filament-saas)[mradder/filament-logger

Audit logging, activity tracking, exports, alerts, and dashboards for Filament admin panels.

141.1k](/packages/mradder-filament-logger)[a909m/filament-statefusion

Filament StateFusion is a powerful FilamentPHP plugin that seamlessly integrates Spatie Laravel Model States into the Filament admin panel. This package provides an intuitive way to manage model states, transitions, and filtering within Filament, enhancing the user experience and developer productivity.

3010.8k1](/packages/a909m-filament-statefusion)[inerba/filament-db-config

A Filament plugin for database-backed application settings and editable content, with caching and easy page generation.

329.1k](/packages/inerba-filament-db-config)[caresome/filament-neobrutalism-theme

A neobrutalism theme for FilamentPHP admin panels

303.2k](/packages/caresome-filament-neobrutalism-theme)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
