PHP Cron Expression

PHP Cron Expression #

Install #

composer self-update --2
composer require dragonmantank/cron-expression
composer update

Example #

<?php

require_once 'vendor/autoload.php';

$schedule = '10 2 * * *';

$cron = new Cron\CronExpression($schedule);
$dates = $cron->getMultipleRunDates(3);
foreach ($dates as $date) {
    echo $date->format('Y-m-d H:i:s') . PHP_EOL;
}