PHP code example of phppkg / hucron

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

    

phppkg / hucron example snippets


use HuCron\HuCron;

echo HuCron::fromStatement('@hourly'); // "0 * * * *"

echo HuCron::fromStatement('@daliy'); // "0 0 * * *"

echo HuCron::fromStatement('@weekly'); // "0 0 * * 0"

echo HuCron::fromStatement('@monthly'); // "0 0 1 * *"

// echo HuCron::fromStatement('@yearly');
echo HuCron::fromStatement('@annually'); // "0 0 1 1 *"

use HuCron\HuCron;

echo HuCron::fromStatement('Every day at midnight');
// "0 0 * * *"

echo HuCron::fromStatement('Every 15 minutes at midnight on the weekend');
// "*/15 0 * * 0,6"

echo HuCron::fromStatement('Every other minute in August at noon on a weekday');
// "*/2 12 * 8 1,2,3,4,5"

echo HuCron::fromStatement('The 1st day in April at midnight');
// "0 0 1 4 *"

echo HuCron::fromStatement('Every day on the weekday at 2:25pm');
// "25 14 * * 1,2,3,4,5"