jeffersongoncalves / filament-centrifugo
Realtime Filament notifications over Centrifugo websockets: injects a Laravel Echo stand-in into the panel and turns off database-notification polling.
Package info
github.com/jeffersongoncalves/filament-centrifugo
pkg:composer/jeffersongoncalves/filament-centrifugo
Requires
- php: ^8.2
- filament/filament: ^5.0
- jeffersongoncalves/laravel-centrifugo: ^1.0
Requires (Dev)
- larastan/larastan: ^2.0|^3.0
- laravel/pint: ^1.0
- orchestra/testbench: ^10.0|^11.0
- pestphp/pest: ^3.0|^4.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Filament Centrifugo
Realtime Filament notifications over Centrifugo websockets, built on jeffersongoncalves/laravel-centrifugo. The plugin:
- injects a Laravel Echo stand-in into the panel for logged-in users — Filament's database and broadcast notifications arrive over the websocket, no Pusher protocol, no npm build;
- connects as the panel's auth guard (an
adminpanel connects as the admin, even with awebuser logged in on the same browser); - turns database-notification polling off, and refreshes the bell live for every stored Filament notification —
sendToDatabase()works with or withoutisEventDispatched: true.
Compatibility
| Package Version | Filament Version |
|---|---|
| 1.x | 3.x |
| 2.x | 4.x |
| 3.x | 5.x |
Requires Laravel 12 or 13 (from laravel-centrifugo).
Installation
You can install the package via composer:
composer require jeffersongoncalves/filament-centrifugo
Configure Centrifugo and the .env as described in laravel-centrifugo:
BROADCAST_CONNECTION=centrifugo CENTRIFUGO_API_URL=http://127.0.0.1:8000/api CENTRIFUGO_API_KEY=<API_KEY> CENTRIFUGO_TOKEN_HMAC_SECRET=<SECRET> CENTRIFUGO_URL=https://ws.your-app.com
Usage
Register the plugin in your panel:
use JeffersonGoncalves\Filament\Centrifugo\CentrifugoPlugin; public function panel(Panel $panel): Panel { return $panel ->authGuard('admin') ->databaseNotifications() ->plugin(CentrifugoPlugin::make()); }
Enable Laravel's broadcasting auth route and authorize the notification channel on the panel's guard:
// bootstrap/app.php ->withBroadcasting(__DIR__.'/../routes/channels.php') // routes/channels.php Broadcast::channel( 'App.Models.Admin.{id}', fn ($admin, $id) => (string) $admin->id === $id, ['guards' => ['admin']], );
Send notifications as usual — the bell refreshes live:
Notification::make() ->title('Export finished') ->sendToDatabase($admin); // or a toast pushed straight to the open panel Notification::make()->title('Saved')->broadcast($admin);
Broadcast events are queued — run a queue worker.
Keep polling
CentrifugoPlugin::make()->disablePolling(false)
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.
