fidum/laravel-nova-metrics-polling
Easily add polling to all your Laravel Nova metrics and cards!
Maintainers
Package info
github.com/fidum/laravel-nova-metrics-polling
pkg:composer/fidum/laravel-nova-metrics-polling
Fund package maintenance!
Requires
- php: ^8.1
- illuminate/contracts: ^10.0|^11.0|^12.0
- laravel/nova: ^4.26|^5.0
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^6.0|^7.0|^8.0
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^7.0|^8.0|^9.0
- pestphp/pest: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- spatie/laravel-ray: ^1.26
Suggests
None
Provides
None
Conflicts
None
Replaces
None
MIT b78866c393fbd6a3c73aded6d54690c3542b291c
- Dan Mason <fidum.dev.woop@gmail.com>
This package is auto-updated.
Last update: 2026-06-21 00:06:01 UTC
README
👁 Latest Version on Packagist
👁 GitHub Workflow Status (with branch)
👁 Twitter Follow
Easily add polling to all your Laravel Nova metrics and cards!
Installation
You can install the package via composer:
composer require fidum/laravel-nova-metrics-polling
Usage
Firstly, just add the SupportsPolling trait to any of your Metrics or Card classes:
<?php namespace App\Nova\Metrics; use Fidum\LaravelNovaMetricsPolling\Concerns\SupportsPolling; class NewUsers extends Value { use SupportsPolling;
Then in the Dashboard, Resource or Lens cards method where you have registered your card you can call refreshIntervalSeconds and pass in the number of seconds you want the interval to be between refresh requests. You can
also pass a closure as needed.
use App\Nova\Metrics\NewUsers; use App\Nova\Metrics\NewOrders; public function cards(NovaRequest $request) { return [ NewUsers::make()->refreshIntervalSeconds(30), NewOrders::make()->refreshIntervalSeconds(fn () => 30), ]; }
If preferred, you can call refreshIntervalMilliseconds instead and pass in the number of milliseconds you want the interval to be between refresh requests.
use App\Nova\Metrics\NewUsers; use App\Nova\Metrics\NewOrders; public function cards(NovaRequest $request) { return [ NewUsers::make()->refreshIntervalMilliseconds(30000), NewOrders::make()->refreshIntervalMilliseconds(fn () => 30000), ]; }
That is it, your cards should now be polling at the specified intervals! 🎉
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.
