croustibat/filament-jobs-monitor
This is a package to monitor background jobs for FilamentPHP. It is inspired by Laravel Horizon and is compatible with all drivers.


Check your filamentPHP version before installing:
| Version | FilamentPHP | PHP |
|---|---|---|
| 1.* | 2.* | 8.1 |
| 2.* | 3.* | >= 8.1 |
| 3.* | 4.* | >= 8.1 |
| 4.* | 5.* | >= 8.2 |
Install the package via composer:
composer require croustibat/filament-jobs-monitor
Publish and run the migrations using:
php artisan vendor:publish --tag="filament-jobs-monitor-migrations"
php artisan migrate
The global plugin config can be published using the command below:
php artisan vendor:publish --tag="filament-jobs-monitor-config"
This is the content of the published config file:
return [
'resources' => [
'enabled' => true,
'label' => 'Job',
'plural_label' => 'Jobs',
'navigation_group' => 'Settings',
'navigation_icon' => 'heroicon-o-cpu-chip',
'navigation_sort' => null,
'navigation_count_badge' => false,
'resource' => Croustibat\FilamentJobsMonitor\Resources\QueueMonitorResource::class,
'cluster' => null,
'sub_navigation_position' => null, // SubNavigationPosition::Top or ::Sidebar
],
'failures' => [
'enabled' => true,
'polling_interval' => '10s',
],
'pruning' => [
'enabled' => true,
'retention_days' => 7,
],
'queues' => [
'default'
],
'tenancy' => [
'enabled' => false,
'model' => null, // e.g., App\Models\Tenant::class
'column' => 'tenant_id',
],
];
NOTE: Since there isn't a universal way to retrieve all used queues, it's necessary to define them to obtain all pending jobs.
The Failures page groups failed jobs by signature — exception class, job class and normalised message (dynamic values such as ids, uuids and quoted strings are stripped) — so a thousand occurrences of the same error show up as a single row instead of a thousand, Sentry-style.
It includes:
The page can be disabled with 'failures' => ['enabled' => false]. Failure grouping requires the add_failures_to_filament-jobs-monitor_table migration — republish the migrations, migrate and publish the plugin assets when upgrading:
php artisan vendor:publish --tag="filament-jobs-monitor-migrations"
php artisan migrate
php artisan filament:assets
If the migration has not been run, the plugin keeps working as before and simply skips failure grouping.
The QueueMonitor model uses Laravel's Prunable trait and will prune records older than pruning.retention_days (default: 7 days) when pruning.enabled is true.
Important: Laravel's built-in
php artisan model:prunecommand only auto-discovers prunable models that live in your application'sapp/Modelsdirectory. BecauseQueueMonitoris shipped inside this package (vendor/...), it is never picked up by a baremodel:prunecall — this is the most common cause of "the model is not pruning".
You have two ways to prune the records:
1. Use the dedicated command shipped with this package (recommended):
php artisan filament-jobs-monitor:prune
This targets the package model directly, so it works regardless of your app structure. Schedule it in routes/console.php (Laravel 11+) or app/Console/Kernel.php:
use Illuminate\Support\Facades\Schedule;
Schedule::command('filament-jobs-monitor:prune')->daily();
2. Or call Laravel's model:prune with an explicit --model flag:
php artisan model:prune --model="Croustibat\FilamentJobsMonitor\Models\QueueMonitor"
Pruning can also be toggled/configured at the plugin level:
FilamentJobsMonitorPlugin::make()
->enablePruning() // or ->enablePruning(false) to disable
->pruningRetention(14); // keep records for 14 days
Sometimes it's useful to extend the model to add some custom methods. You can do it by extending the model by creating your own model :
$ php artisan make:model MyQueueMonitor
Then you can extend the model by adding your own methods :
<?php
namespace App\Models;
use \Croustibat\FilamentJobsMonitor\Models\QueueMonitor as CroustibatQueueMonitor;
class MyQueueMonitor extends CroustibatQueueMonitor {}
This plugin supports multi-tenancy for applications using Filament's built-in tenant functionality. When enabled, job monitors are automatically filtered by the current tenant.
Features:
tenantId property in your job classConfiguration:
Enable multi-tenancy in your published config file:
'tenancy' => [
'enabled' => true,
'model' => App\Models\Tenant::class, // Your tenant model
'column' => 'tenant_id', // Column name in queue_monitors table
],
Migration:
If you enable tenancy after initial installation, re-publish and run the migration to add the tenant_id column:
php artisan vendor:publish --tag="filament-jobs-monitor-migrations" --force
php artisan migrate
Job Requirements:
For jobs to be associated with a tenant, they must have a public tenantId property:
class MyTenantJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function __construct(
public int|string $tenantId, // Required for multi-tenancy
// ... other properties
) {}
}
When dispatching the job, pass the current tenant ID:
MyTenantJob::dispatch(
tenantId: Filament::getTenant()->id,
// ... other arguments
);
See examples/TenantAwareExportJob.php for a complete example.
If you are using Filament Panels, you can register the Plugin to your Panel configuration. This will register the plugin's resources as well as allow you to set configuration using optional chainable methods.
For example in your app/Providers/Filament/AdminPanelProvider.php file:
<?php
use \Croustibat\FilamentJobsMonitor\FilamentJobsMonitorPlugin;
...
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
FilamentJobsMonitorPlugin::make()
]);
}
Just run a Background Job and go to the route /admin/queue-monitors to see the jobs.
Go to example folder to see a Job example file.
Then you can call your Job with the following code:
public static function table(Table $table): Table
{
return $table
// rest of your code
...
->bulkActions([
BulkAction::make('export-jobs')
->label('Background Export')
->icon('heroicon-o-cog')
->action(function (Collection $records) {
UsersCsvExportJob::dispatch($records, 'users.csv');
Notification::make()
->title('Export is ready')
->body('Your export is ready. You can download it from the exports page.')
->success()
->seconds(5)
->icon('heroicon-o-inbox-in')
->send();
})
])
}
// AdminPanelProvider.php
->plugins([
// ...
FilamentJobsMonitorPlugin::make()
->enableNavigation(),
])
Or you can use a closure to enable navigation only for specific users:
// AdminPanelProvider.php
->plugins([
// ...
FilamentJobsMonitorPlugin::make()
->enableNavigation(
fn () => auth()->user()->can('view_queue_job') || auth()->user()->can('view_any_queue_job)'),
),
])
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.
How can I help you explore Laravel packages today?