1. Go to this page and download the library: Download ecommit/frequency-generator 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/ */
ecommit / frequency-generator example snippets
use Ecommit\FrequencyGenerator\FrequencyGenerator;
$generator = new FrequencyGenerator();
//Every day at 08:00:00 and 10:00:00
$dateTimeObject = $generator->nextInEveryDay([new \DateTime('10:00:00'), new \DateTime('08:00:00')]);
//Every monday (at 08:00:00 and 10:00:00) and tuesday (at 08:00:00 and 10:00:00)
$dateTimeObject = $generator->nextInEveryWeek([1, 2], [new \DateTime('10:00:00'), new \DateTime('08:00:00')]);
//Every 1st (at 08:00:00 and 10:00:00) and 2nd (at 08:00:00 and 10:00:00)
$dateTimeObject = $generator->nextInEveryMonth([1, 2], [new \DateTime('10:00:00'), new \DateTime('08:00:00')]);
//Every 1st and 15th February, May, August and November (at 08:00:00 and 10:00:00)
$dateTimeObject = $generator->nextInEveryQuart([2], [1, 15], [new \DateTime('10:00:00'), new \DateTime('08:00:00')]);
//Every 1st and 15th February and August (at 08:00:00 and 10:00:00)
$dateTimeObject = $generator->nextInEveryHalfYear([2], [1, 15], [new \DateTime('10:00:00'), new \DateTime('08:00:00')]);
//Every 1st and 15th January (at 08:00:00 and 10:00:00)
$dateTimeObject = $generator->nextInEveryYear([1], [1, 15], [new \DateTime('10:00:00'), new \DateTime('08:00:00')]);
use Ecommit\FrequencyGenerator\FrequencyGenerator;
$generator = new FrequencyGenerator();
$date = $generator->nextInEveryDay([new \DateTime('10:00:00'), new \DateTime('08:00:00')]);
echo get_class($date); //This example will output "DateTime"
$generator->generateDateTimeImmutable(true);
$date = $generator->nextInEveryDay([new \DateTime('10:00:00'), new \DateTime('08:00:00')]);
echo get_class($date); //This example will output "DateTimeImmutable"
$generator->generateDateTimeImmutable(false);
$date = $generator->nextInEveryDay([new \DateTime('10:00:00'), new \DateTime('08:00:00')]);
echo get_class($date); //This example will output "DateTime"
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.