job-runner / job-runner
Installs: 26 362
Dependents: 3
Suggesters: 0
Security: 0
Stars: 6
Watchers: 2
Forks: 0
Open Issues: 1
Requires
- php: ~8.2.0 || ~8.3.0 || ~8.4.0
- dragonmantank/cron-expression: ^3.4.0
- symfony/clock: ^6.3 || ^7.0
- symfony/lock: ^5.0 || ^6.0 || ^7.0
- symfony/process: ^5.0 || ^6.0 || ^7.0
Requires (Dev)
- doctrine/coding-standard: ^12.0
- phpstan/phpstan: ^2.0.1
- phpunit/phpunit: ^11.4.3
- dev-main
- 8.4.x-dev
- 1.4.0
- 1.3.0
- 1.2.0
- 1.1.0
- 1.0.2
- 1.0.1
- 1.0.0
- 0.2.0
- 0.1.1
- 0.1.0
- dev-dependabot/composer/phpstan/phpstan-tw-2.1.29
- dev-dependabot/composer/phpunit/phpunit-tw-12.3.15
- dev-renovate/doctrine-coding-standard-14.x
- dev-update-march
- dev-update-deps2025
- dev-clean
- dev-phpunit11
- dev-fezfez-patch-2
- dev-addclock
- dev-update-deps
- dev-remove-php-job
- dev-coding-standard-10
- dev-fezfez-patch-1
This package is auto-updated.
Last update: 2025-10-01 06:54:54 UTC
README
Install
composer require job-runner/job-runner
This cron job manager is inspired by https://github.com/jobbyphp/jobby but with various improvements
- It use
symfony/locker
so you can use the power of it - It use
symfony/process
instead ofexec
- It lock by task and not for all task
- It has an event manager
Simple Sample
<?php declare(strict_types=1); use JobRunner\JobRunner\Job\CliJob; use JobRunner\JobRunner\Job\JobList; use JobRunner\JobRunner\CronJobRunner; require 'vendor/autoload.php'; $jobList = new JobList(); $jobList->push(new CliJob('php ' . __DIR__ . '/tutu.php', '* * * * *')); $jobList->push(new CliJob('php ' . __DIR__ . '/tutu2.php', '* * * * *')); CronJobRunner::create()->run($jobList); // or CronJobRunner::create()->run(JobList::fromArray([ [ 'command' => 'php ' . __DIR__ . '/tutu.php', 'cronExpression' => '* * * * *', ],[ [ 'command' => 'php ' . __DIR__ . '/tutu2.php', 'cronExpression' => '* * * * *', ] ]));
Using you own locker storage
<?php declare(strict_types=1); use JobRunner\JobRunner\Job\CliJob; use JobRunner\JobRunner\Job\JobList; use JobRunner\JobRunner\CronJobRunner; require 'vendor/autoload.php'; $mySymfonyLockerStore = new \Symfony\Component\Lock\Store\MongoDbStore(); $jobList = new JobList(); $jobList->push(new CliJob('php ' . __DIR__ . '/tutu.php', '* * * * *')); CronJobRunner::create()->withPersistingStore($mySymfonyLockerStore)->run($jobList);
Listening to events
there is various of event you can listen
JobRunner\JobRunner\Event\JobSuccessEvent
JobRunner\JobRunner\Event\JobFailEvent
JobRunner\JobRunner\Event\JobIsLockedEvent
JobRunner\JobRunner\Event\JobNotDueEvent
JobRunner\JobRunner\Event\JobStartEvent
Plugins
- job-runner/psr-log-adapter Adapter to logs events in psr/log
- job-runner/symfony-console-adapter Adapter to logs events in symfony/console
- job-runner/symfony-notifier-adapter Adapter to logs events in symfony/notifier