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.
panels::user-menu.before), design tokens (CSS variables for colors), and asset pipeline. This ensures zero visual friction—the badge inherits the panel’s theme (dark mode, RTL, etc.) automatically./_filament-connection-badge/ping) is stateless and returns JSON { ok: true, ts: ... }, making it lightweight and scalable. No database or caching layer is required, reducing operational overhead..env or PHP config, enabling granular control without code changes.FilamentAsset, so no vite or npm is required. Running php artisan filament:assets syncs the package’s CSS/JS into Filament’s build process.filament-connection-badge.ping) with configurable middleware (e.g., auth, throttle). This allows secure deployment (e.g., restrict to authenticated users only).| Risk Area | Assessment | Mitigation |
|---|---|---|
| Frontend Dependencies | Relies on Alpine.js (included via Filament). If Filament’s asset pipeline fails, the badge may break. | Test filament:assets in staging. Monitor Filament updates for Alpine.js version conflicts. |
| Ping Endpoint Security | Default route uses web middleware (publicly accessible). Misconfiguration could expose the heartbeat endpoint to abuse (e.g., DDoS via ping floods). |
Hardening: Add auth middleware or a Laravel Gate (permission config). Use throttle to limit requests (e.g., 60,1). |
| Latency Measurement | Uses performance.now() for ping timing, which may be less accurate than server-side timestamps (e.g., hrtime()). |
Accept client-side measurement as a relative indicator (not absolute). For critical systems, supplement with server-side metrics (e.g., Laravel Telescope). |
| Offline Detection | Relies on navigator.onLine + failed pings. Flaky networks (e.g., intermittent connectivity) may cause false positives/negatives. |
Configure max_samples and thresholds conservatively (e.g., full: 300ms). Use the overlay sparingly (show_overlay: false for non-critical panels). |
| Filament Version Lock | Explicitly supports v4 and v5. Future Filament major versions may break the render hook or asset pipeline. | Monitor Filament’s changelog for breaking changes. Test against Filament v6 (if released) early. |
| Performance Impact | Each ping adds a small HTTP request (~50ms interval). High-traffic panels may see increased server load if not throttled. | Enable throttle (e.g., 60,1) and monitor server metrics. Disable for non-critical panels (enabled: false). |
Security:
auth middleware or a Laravel Gate)? If so, how will we handle guest users accessing Filament panels?throttle: 60,1) to prevent abuse?Observability:
Customization:
php artisan vendor:publish --tag="filament-connection-badge-views"
php artisan vendor:publish --tag="filament-connection-badge-assets"
full: 150ms) to match our SLOs?Deployment:
show_overlay: false) for less critical panels?Localization:
php artisan vendor:publish --tag="filament-connection-badge-translations"
Testing:
auth, throttle) and Gates for permission checks, aligning with existing security patterns.Pre-Integration Checks:
composer show filament/filament) is v4 or v5.panels::user-menu.before).Installation:
composer require rawand201/filament-connection-badge
php artisan filament:assets
php artisan vendor:publish --tag="filament-connection-badge-config"
php artisan vendor:publish --tag="filament-connection-badge-translations"
php artisan vendor:publish --tag="filament-connection-badge-views"
Configuration:
.env (e.g., for security/middleware):
FILAMENT_CONNECTION_BADGE_ENABLED=true
FILAMENT_CONNECTION_BADGE_PERMISSION=viewConnectionBadge
FILAMENT_CONNECTION_BADGE_THROTTLE=60,1
FILAMENT_CONNECTION_BADGE_PING_URL=/favicon.ico
auth middleware or a Gate.Testing:
200 OK with JSON payload.permission is set).Rollout:
| Component | Compatibility
How can I help you explore Laravel packages today?