This package provides a symfony/notifier adapter for JobRunner.
composer require job-runner/symfony-notifier-adapter
<?php
declare(strict_types=1);
use JobRunner\JobRunner\Job\CliJob;
use JobRunner\JobRunner\Job\JobList;
use JobRunner\JobRunner\CronJobRunner;
use Symfony\Component\Notifier\Bridge\RocketChat\RocketChatTransport;
use Symfony\Component\Notifier\Channel\ChatChannel;
use Symfony\Component\Notifier\Notifier;
use JobRunner\JobRunner\SymfonyNotifier\SymfonyNotifierEventListener;
require 'vendor/autoload.php';
$rocket = new RocketChatTransport('mytoken', '#mychannel');
$rocket->setHost('chat.myhost.com');
$chat = new ChatChannel($rocket);
$notifier = new Notifier(['chat' => $chat]);
$jobCollection = new JobList();
$jobCollection->push(new CliJob('php ' . __DIR__ . '/tutu.php', '* * * * *'));
CronJobRunner::create()
->withEventListener((new SymfonyNotifierEventListener($notifier))->withNotificationChannelFail(['chat']))
->run($jobCollection);