1. Go to this page and download the library: Download nephifey/cron-expression library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nephifey / cron-expression example snippets
# ┌───────────── minute (0–59)
# │ ┌───────────── hour (0–23)
# │ │ ┌───────────── day of the month (1–31)
# │ │ │ ┌───────────── month (1–12)
# │ │ │ │ ┌───────────── day of the week (0–6) (Sunday to Saturday;
# │ │ │ │ │ 7 is also Sunday on some systems)
# │ │ │ │ │
# │ │ │ │ │
# * * * * * <command to execute>
# crontab.php
"* * * * *" => [
function () { echo "-- Run important code here every minute --\r\n"; },
function () { echo "-- Run important code here every minute #2 --\r\n"; },
],
"*/5 * * * *" => [
function () { echo "-- Run important code here every five minutes --\r\n"; },
],
];
foreach ($jobs as $expression => $callables) {
$parser = $parser ?? new \CronExpression\Parser();
if ($parser->parse($expression)->isDue())
$combinedCallables = array_merge(($combinedCallables ?? []), $callables);
}
foreach (($combinedCallables ?? []) as $callable) {
call_user_func($callable);
}