orisai/scheduler

Cron job scheduler - with locks, parallelism and more

2.1.2 2024-07-02 22:49 UTC

This package is auto-updated.

Last update: 2024-07-02 22:50:26 UTC


README

Orisai
Scheduler

Cron job scheduler - with locks, parallelism and more

📄 Check out our documentation.

💸 If you like Orisai, please make a donation. Thank you!

Create script with scheduler setup (e.g. bin/scheduler.php)

use Cron\CronExpression;
use Orisai\Scheduler\SimpleScheduler;

$scheduler = new SimpleScheduler();

// Add jobs
$scheduler->addJob(
	new CallbackJob(fn() => exampleTask()),
	new CronExpression('* * * * *'),
);

$scheduler->run();

Configure crontab to run your script each minute

* * * * * cd path/to/project && php bin/scheduler.php >> /dev/null 2>&1

Looking for more? Documentation is here.