Weave Code
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

Filament Connection Badge Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Filament-Centric Design: The package is optimized for Filament v4/v5, leveraging its render hooks (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.
  • Stateless Heartbeat: The ping endpoint (/_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.
  • Alpine.js Dependency: Uses Alpine.js (included via Filament’s asset pipeline) for client-side reactivity, avoiding heavier frameworks like Vue/React. This aligns with Filament’s modern stack while keeping bundle size minimal.
  • Modular Configuration: All behavior (ping interval, thresholds, permissions, render hook) is configurable via .env or PHP config, enabling granular control without code changes.

Integration Feasibility

  • Laravel/Filament Compatibility: Works with Laravel 10–13 and Filament v4/v5, covering most production stacks. The auto-discoverable service provider eliminates manual bootstrapping.
  • Asset Pipeline: Assets are registered via FilamentAsset, so no vite or npm is required. Running php artisan filament:assets syncs the package’s CSS/JS into Filament’s build process.
  • Route Integration: The package registers a named route (filament-connection-badge.ping) with configurable middleware (e.g., auth, throttle). This allows secure deployment (e.g., restrict to authenticated users only).
  • RTL/i18n Support: Built-in right-to-left (RTL) CSS and multi-language translations (English, Arabic, Kurdish) reduce localization effort for global teams.

Technical Risk

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).

Key Questions for the Team

  1. Security:

    • Should the ping endpoint require authentication (e.g., auth middleware or a Laravel Gate)? If so, how will we handle guest users accessing Filament panels?
    • Should we rate-limit the endpoint (e.g., throttle: 60,1) to prevent abuse?
  2. Observability:

    • Do we need server-side logging of ping failures (e.g., to Sentry or Laravel Logs)? The package tracks metrics client-side only.
    • Should we extend the tooltip to show custom metrics (e.g., queue length, external API latency)?
  3. Customization:

    • Will we override the view/styles (e.g., to match our brand)? If so, publish the assets early:
      php artisan vendor:publish --tag="filament-connection-badge-views"
      php artisan vendor:publish --tag="filament-connection-badge-assets"
      
    • Should we adjust the latency thresholds (e.g., full: 150ms) to match our SLOs?
  4. Deployment:

    • Which Filament panels should include the badge? (e.g., all panels, or only production/staging?)
    • Should we disable the overlay (show_overlay: false) for less critical panels?
  5. Localization:

    • Do we need additional translations beyond English/Arabic/Kurdish? If so, publish and extend the translations:
      php artisan vendor:publish --tag="filament-connection-badge-translations"
      
  6. Testing:

    • Should we mock the ping endpoint in tests to simulate offline/latency conditions?
    • How will we verify the badge’s accuracy in staging? (e.g., throttle network speed or block requests to test offline mode.)

Integration Approach

Stack Fit

  • Laravel/Filament Alignment: The package is designed for Laravel 10+ and Filament v4/v5, making it a first-class citizen in the stack. It avoids reinventing Filament’s asset pipeline, render hooks, or theming system.
  • Minimal Dependencies: Only requires Alpine.js (included via Filament) and PHP 8.2+. No Node.js, Vite, or custom build steps are needed.
  • Security Model: Leverages Laravel’s middleware (e.g., auth, throttle) and Gates for permission checks, aligning with existing security patterns.
  • Observability: While the package is client-side only, it integrates with Filament’s topbar (a high-visibility area for users) and can be extended to log metrics server-side if needed.

Migration Path

  1. Pre-Integration Checks:

    • Verify Filament version (composer show filament/filament) is v4 or v5.
    • Confirm PHP 8.2+ and Laravel 10+ are in use.
    • Check for custom Filament render hooks that might conflict with the default (panels::user-menu.before).
  2. Installation:

    composer require rawand201/filament-connection-badge
    php artisan filament:assets
    
    • Optional: Publish config/translations/views if customization is needed:
      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"
      
  3. Configuration:

    • Set environment variables in .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
      
    • Critical: Secure the ping endpoint by adding auth middleware or a Gate.
  4. Testing:

    • Unit Tests: Verify the ping endpoint returns 200 OK with JSON payload.
    • UI Tests: Check the badge appears in the topbar and updates on hover.
    • Offline Simulation: Throttle network speed (e.g., via Chrome DevTools) to test latency/offline states.
    • Permission Tests: Ensure the badge hides for unauthorized users (if permission is set).
  5. Rollout:

    • Phase 1: Enable in staging/production Filament panels.
    • Phase 2: Monitor server metrics (e.g., ping endpoint load) and user feedback.
    • Phase 3: Extend to customer-facing panels (if applicable) or disable for non-critical panels.

Compatibility

| Component | Compatibility

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.
craftcms/url-validator
directorytree/privacy-filter-classifier
directorytree/privacy-filter
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi
splash/scopes
splash/toolkit
testo/output-teamcity
testo/bridge-symfony