PHP code example of wilianx7 / php-recurring

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

    

wilianx7 / php-recurring example snippets


$recurringConfig = new RecurringConfig();

$recurringConfig->setStartDate(Carbon::create(2019, 12, 26, 8, 0, 0))
    ->setFrequencyType(FrequencyTypeEnum::DAY())
    ->setFrequencyInterval(1)
    ->setFrequencyEndType(FrequencyEndTypeEnum::NEVER())
    ->setEndDate(Carbon::create(2019, 12, 31, 23, 59, 59));

$datesCollection = RecurringBuilder::forConfig($recurringConfig)->startRecurring();

$recurringConfig = new RecurringConfig();

$recurringConfig->setStartDate(Carbon::create(2019, 1, 1, 8, 0, 0))
    ->setFrequencyType(FrequencyTypeEnum::WEEK())
    ->setFrequencyInterval(1)
    ->setFrequencyEndType(FrequencyEndTypeEnum::AFTER())
    ->setFrequencyEndValue(5)
    ->setRepeatIn([WeekdayEnum::MONDAY(), WeekdayEnum::SUNDAY()])
    ->setEndDate(Carbon::create(2019, 12, 31, 23, 59, 59));

$datesCollection = RecurringBuilder::forConfig($recurringConfig)->startRecurring();

$recurringConfig = new RecurringConfig();

$recurringConfig->setStartDate(Carbon::create(2019, 1, 1, 8, 0, 0))
    ->setFrequencyType(FrequencyTypeEnum::MONTH())
    ->setFrequencyInterval(1)
    ->setFrequencyEndType(FrequencyEndTypeEnum::IN())
    ->setFrequencyEndValue(Carbon::create(2019, 11, 30))
    ->setRepeatIn(27)
    ->setEndDate(Carbon::create(2019, 12, 31, 23, 59, 59));

$datesCollection = RecurringBuilder::forConfig($recurringConfig)->startRecurring();

$recurringConfig = new RecurringConfig();

$recurringConfig->setStartDate(Carbon::create(2019, 1, 1, 8, 0, 0))
    ->setFrequencyType(FrequencyTypeEnum::MONTH())
    ->setFrequencyInterval(1)
    ->setFrequencyEndType(FrequencyEndTypeEnum::IN())
    ->setFrequencyEndValue(Carbon::create(2019, 11, 30))
    ->setRepeatIn(['day' => 27, 'month' => 10])
    ->setEndDate(Carbon::create(2019, 12, 31, 23, 59, 59));

$datesCollection = RecurringBuilder::forConfig($recurringConfig)->startRecurring();

composer