rawand201/filament-connection-badge
Drop-in connection status badge for Filament panels. Shows live signal bars in the topbar, ping graph on hover, and optional full-screen offline overlay. Works with Filament v4/v5, matches theme/dark mode, supports RTL and translations.
A drop-in connection status badge for Filament panels — shows a live signal-bars icon in the topbar next to the user avatar, a live ping graph on hover, and a full-screen overlay when the connection drops.
Works with Filament v4 and v5, uses Filament's design tokens so it follows your panel's theme and dark mode automatically, and fully supports RTL and multi-language UIs.
| Version | |
|---|---|
| PHP | ^8.2 (8.2 / 8.3 / 8.4) |
| Laravel | 10.x / 11.x / 12.x / 13.x |
| Filament | ^4.0 | ^5.0 |
composer require rawand201/filament-connection-badge
The service provider is auto-discovered, so no manual registration is needed.
php artisan filament:assets
php artisan vendor:publish --tag="filament-connection-badge-config"
php artisan vendor:publish --tag="filament-connection-badge-translations"
That's it — the badge is now rendered in the topbar of every Filament panel.
The published config/filament-connection-badge.php:
return [
'enabled' => env('FILAMENT_CONNECTION_BADGE_ENABLED', true),
// Filament panel hook name (default: before the user menu). See Filament\View\PanelsRenderHook.
'render_hook' => env(
'FILAMENT_CONNECTION_BADGE_RENDER_HOOK',
'panels::user-menu.before'
),
// Optional Gate / policy ability — badge and ping require auth()->user()->can(...) when set
'permission' => env('FILAMENT_CONNECTION_BADGE_PERMISSION'),
'show_label' => true,
'show_overlay' => true,
'route' => [
'prefix' => '_filament-connection-badge',
'middleware' => ['web'],
'throttle' => env('FILAMENT_CONNECTION_BADGE_THROTTLE'), // e.g. '60,1'; null = no throttle
],
'ping_url' => env('FILAMENT_CONNECTION_BADGE_PING_URL'),
'ping_interval' => 5000,
'thresholds' => [
'full' => 200,
'medium' => 600,
],
'max_samples' => 30,
];
FILAMENT_CONNECTION_BADGE_ENABLED=true
FILAMENT_CONNECTION_BADGE_RENDER_HOOK=panels::topbar.end
FILAMENT_CONNECTION_BADGE_PERMISSION=viewConnectionBadge
FILAMENT_CONNECTION_BADGE_PING_URL=/favicon.ico
FILAMENT_CONNECTION_BADGE_THROTTLE=60,1
FILAMENT_CONNECTION_BADGE_ENABLED=false
--success-*, --warning-*, --danger-* tokens/_filament-connection-badge/ping route, so the badge actually proves your Laravel application is responding (PHP + router + middleware), not just the static file serverunicode-bidi: isolate) so measurements stay readable in RTL UIscan() permission, optional heartbeat throttling, latency thresholds, route prefix & middleware, ping interval, history size, label visibility, overlay on/offFilamentAssetpanels::user-menu.before, same as PanelsRenderHook::USER_MENU_BEFORE).route('filament-connection-badge.ping') (default URI /_filament-connection-badge/ping) that returns a small JSON payload { ok: true, ts: ... } with Cache-Control: no-store.ping_interval ms and measures the round-trip time with performance.now(). Because the request goes through the Laravel router and middleware stack, a successful ping proves your app is responding — not just nginx serving a static file.thresholds.max_samples pings is kept in memory. Failed pings count toward the packet-loss rate and visually break the sparkline.navigator.onLine and the online / offline events are used as an immediate hint; a confirmation ping always follows.Nothing is persisted server-side — the route is stateless and the rolling sample buffer lives in the browser.
By default the route uses the web middleware so sessions and cookies work, but it's publicly reachable. You can lock it down in two ways (combinable):
Middleware — require an authenticated session:
'route' => [
'prefix' => '_filament-connection-badge',
'middleware' => ['web', 'auth'],
],
Or Filament's panel auth middleware:
'middleware' => ['web', \Filament\Http\Middleware\Authenticate::class],
Permission — set permission (or FILAMENT_CONNECTION_BADGE_PERMISSION) to a Laravel Gate ability or policy method name. When set, the badge is hidden and the ping endpoint returns 403 unless auth()->user()->can($permission). Register the ability in a service provider (e.g. Gate::define('viewConnectionBadge', ...)).
You can also set route.throttle in config (or FILAMENT_CONNECTION_BADGE_THROTTLE, e.g. 60,1) to append Laravel’s throttle:{max},{decayMinutes} middleware to the heartbeat route only.
To add another language, publish the translations and copy any of the files:
php artisan vendor:publish --tag="filament-connection-badge-translations"
php artisan vendor:publish --tag="filament-connection-badge-views"
You can either:
.fcb-* classes — every color is declared with var(--gray-*) / var(--success-*) / etc. so they automatically track your panel's theme.composer sync-assets
composer test
composer analyse # PHPStan (src/)
See CHANGELOG.
The MIT License (MIT). See LICENSE.
How can I help you explore Laravel packages today?