PHP code example of spatie / laravel-failed-job-monitor
1. Go to this page and download the library: Download spatie/laravel-failed-job-monitor library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
spatie / laravel-failed-job-monitor example snippets
return [
/**
* 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' => ['mail', 'slack'],
'mail' => [
'to' => ['[email protected]'],
],
'slack' => [
'webhook_url' => env('FAILED_JOB_SLACK_WEBHOOK_URL'),
],
];
namespace App\Notifications;
use Spatie\FailedJobMonitor\Notification;
class FailedJobNotification
{
public static function notificationFilter(Notification $notification): bool
{
return true;
}
}