1. Go to this page and download the library: Download effiana/cron 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/ */
effiana / cron example snippets
ite folder content to log every five minutes.
$job1 = new \Effiana\Job\ShellJob();
$job1->setCommand('ls -la /path/to/folder');
$job1->setSchedule(new \Effiana\Schedule\CrontabSchedule('*/5 * * * *'));
// Remove folder contents every hour.
$job2 = new \Effiana\Job\ShellJob();
$job2->setCommand('rm -rf /path/to/folder/*');
$job2->setSchedule(new \Effiana\Schedule\CrontabSchedule('0 0 * * *'));
$resolver = new \Effiana\Resolver\ArrayResolver();
$resolver->addJob($job1);
$resolver->addJob($job2);
$cron = new \Effiana\Cron();
$cron->setExecutor(new \Effiana\Executor\Executor());
$cron->setResolver($resolver);
$cron->run();