Skip to content

Cron job scheduler - with locks, parallelism and more

License

Notifications You must be signed in to change notification settings

orisai/scheduler

Repository files navigation

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.