This is a package to monitor background jobs for FilamentPHP. It is inspired by Laravel Horizon and is compatible with all drivers.
![Screenshot 2023-09-13 at 23 18 44](https://private-user-images.githubusercontent.com/1169456/268304733-a5d5a088-865f-4265-bd37-13dce213f529.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjUwNjQxNTQsIm5iZiI6MTcyNTA2Mzg1NCwicGF0aCI6Ii8xMTY5NDU2LzI2ODMwNDczMy1hNWQ1YTA4OC04NjVmLTQyNjUtYmQzNy0xM2RjZTIxM2Y1MjkucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDgzMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA4MzFUMDAyNDE0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MTY4MTM5OTVhZmQyN2IwMTQ2Njg1MmNhOWI1MWMxNDk3NGMxZDc2NTZiYjkzYmVjZTE2MWU1MTY2MzlmMzFhZCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.RMfwWyF69mwZMDiiO4s-a5Jg_QXu508nu-pjAd_aWLo)
![Screenshot 2023-09-13 at 23 18 23](https://private-user-images.githubusercontent.com/1169456/268304721-e0a7730e-f459-4d99-8a40-5f35337385eb.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjUwNjQxNTQsIm5iZiI6MTcyNTA2Mzg1NCwicGF0aCI6Ii8xMTY5NDU2LzI2ODMwNDcyMS1lMGE3NzMwZS1mNDU5LTRkOTktOGE0MC01ZjM1MzM3Mzg1ZWIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDgzMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA4MzFUMDAyNDE0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NzU4NWMzMmRjYjlmMDE0ZjI1ZjI5ZDU1ZjBkMDVjMzhhNTAwODNhOGRjMWVjM2ZlM2Q3ZWU2YjYzMGI0OGY5YSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.cBQdkWf8KNeKWE-g3I5Khm6FCeKQMTR3DffVpqZEqyI)
Check your filamentPHP version before installing:
Version | FilamentPHP | PHP |
---|---|---|
1.* | 2.* | 8.1.* |
2.* | 3.* | 8.1.* | 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,
],
'pruning' => [
'enabled' => true,
'retention_days' => 7,
],
];
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.
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
\Croustibat\FilamentJobsMonitor\FilamentJobsMonitorPlugin::make()
->label('Job')
->pluralLabel('Jobs')
->enableNavigation(true)
->navigationIcon('heroicon-o-cpu-chip')
->navigationGroup('Settings')
->navigationSort(5)
->navigationCountBadge(true)
->enablePruning(true)
->pruningRetention(7)
->resource(\App\Filament\Resources\CustomJobMonitorResource::class)
]);
}
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();
})
])
}
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.