Skip to main content
Back to packages
1,042 GitHub stars

spatie/laravel-failed-job-monitor

View on GitHub

Description

Get notified when a queued job fails

This package sends notifications if a queued job fails. Out of the box it can send a notification via mail and/or Slack. It leverages Laravel's native notification system.

This is the contents of the default configuration file. Here you can specify the notifiable to which the notifications should be sent. The default notifiable will use the variables specified in this config file.

Add these variables to your .env file:

# Spatie Laravel-failed-job-monitor
FAILED_JOB_MONITOR_ENABLED=true
FAILED_JOB_CHANNELS=mail,slack
FAILED_JOB_EMAILS=[email protected]
FAILED_JOB_SLACK_WEBHOOK_URL=
return [
 
/**
* Whether the failed job monitor is enabled.
*/
'enabled' => env('FAILED_JOB_MONITOR_ENABLED', true),
 
/**
* The notification that will be sent when a job fails.
*/
'notification' => \Spatie\FailedJobMonitor\Notification::class,
 
/**
* The notifiable to which the notification will be sent. The default
* notifiable will use the mail and slack configuration specified
* in this config file.
*/
'notifiable' => \Spatie\FailedJobMonitor\Notifiable::class,
 
/*
* By default notifications are sent for all failures. You can pass a callable to filter
* out certain notifications. The given callable will receive the notification. If the callable
* return false, the notification will not be sent.
*/
'notificationFilter' => null,
 
/**
* The channels to which the notification will be sent.
*/
'channels' => explode(',', env('FAILED_JOB_CHANNELS', 'mail,slack')),
 
'mail' => [
'to' => explode(',', env('FAILED_JOB_EMAILS', '[email protected]')),
],
 
'slack' => [
'webhook_url' => env('FAILED_JOB_SLACK_WEBHOOK_URL'),
],
];

Recent Courses on Laravel Daily

Next.js Basics for Laravel Developers

11 lessons
58 min

Laravel 13 Starter Kit Teams and Customizations

10 lessons
33 min

How to Structure Laravel 13 Projects

16 lessons
1 h 32 min read

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.