defstudio / filament-sidebar-poll
A polling setting to regularly update your Filament sidebar
Package info
github.com/defstudio/filament-sidebar-poll
pkg:composer/defstudio/filament-sidebar-poll
Fund package maintenance!
Requires
- php: ^8.2
- filament/filament: ^5.0
- spatie/laravel-package-tools: ^1.15.0
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.0
- nunomaduro/collision: ^8.0
- orchestra/testbench: ^9.0|^10.0|^11.0
- pestphp/pest: ^3.7|^4.0
- pestphp/pest-plugin-arch: ^3.0|^4.0
- pestphp/pest-plugin-laravel: ^3.0|^4.0
- pestphp/pest-plugin-livewire: ^3.0|^4.0
- rector/rector: ^2.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Automatically refresh your Filament sidebar so navigation badges and other dynamic navigation content stay up to date. Uses Filament's existing Livewire sidebar, with a default polling interval of 10 seconds.
Requirements
- PHP 8.2 or later
- Filament 5
- Laravel 11, 12, or 13 (Laravel 13 requires PHP 8.3 or later)
Installation
composer require defstudio/filament-sidebar-poll
Register the plugin in each panel that should poll:
use DefStudio\FilamentSidebarPoll\SidebarPoll; use Filament\Panel; public function panel(Panel $panel): Panel { return $panel // Your existing panel configuration... ->plugin(SidebarPoll::make()); }
No migrations, assets, custom theme, or build steps are required.
Configuration
Override the interval for an individual panel:
SidebarPoll::make()->pollingInterval('30s')
Intervals must be positive integers followed by ms, s, or m, for example 500ms, 30s, or 1m. Invalid intervals throw an InvalidArgumentException.
To change the default for all panels, publish the configuration:
php artisan vendor:publish --tag="filament-sidebar-poll-config"
This creates config/sidebar-poll.php:
return [ 'interval' => '10s', ];
Per-panel settings take precedence over the configuration file. After changing configuration in production, rebuild your application's configuration cache.
Optionally publish the view:
php artisan vendor:publish --tag="filament-sidebar-poll-views"
Production considerations
Each open sidebar makes approximately one request per interval. Prefer longer intervals when navigation badge queries are expensive or many users are connected. Livewire automatically reduces polling in background tabs; this plugin preserves that behavior. See the Livewire polling documentation.
Use closures for dynamic navigation values so they are recalculated when the sidebar renders. Values cached by your application retain that cache's lifetime.
Polling applies to the sidebar. Panels using top navigation do not have a sidebar to refresh.
Development
composer install
composer test
composer analyse
composer test:lint
The integration tests render Filament's real sidebar and call its Livewire refresh action, including a changing navigation badge. Browser timers and production load require validation in the consuming application.
Changelog
See CHANGELOG.
Contributing
See CONTRIBUTING.
Security
See our security policy.
Credits
License
MIT. See LICENSE.