PHP code example of helthe / chronos

1. Go to this page and download the library: Download helthe/chronos 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/ */

    

helthe / chronos example snippets


use Helthe\Component\Chronos\Crontab;
use Helthe\Component\Chronos\Job\CommandJob;

$crontab = new Crontab();
$job = new CommandJob('@hourly', '/usr/bin/my_great_command');

$crontab->add($job);

$crontab->update();

use Helthe\Component\Chronos\CronJobScheduler;
use Helthe\Component\Chronos\Job\CommandJob;

$scheduler = new CronJobScheduler();
$job = new CommandJob('@hourly', '/usr/bin/my_great_command');

$scheduler->add($job);

$scheduler->runJobs();