PHP code example of koertho / contao-advanced-repeating-events-bundle

1. Go to this page and download the library: Download koertho/contao-advanced-repeating-events-bundle 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/ */

    

koertho / contao-advanced-repeating-events-bundle example snippets


use Koertho\AdvancedRepeatingEventsBundle\Recurrence\RecurrenceCalculatorFactory;

function (RecurrenceCalculatorFactory $factory) {
    $calculator = $factory->createForEvent($event);
    
    $occurrences = $calculator->listOccurrencesInRange(rangeStart: new \DateTime('2024-01-01'), rangeEnd: new \DateTime('2024-12-31'), limit: 12, excludeOriginal: false);
    // Returns an array of start and end dates like [['start' => 1711922400, 'end' => 1711926000], ...]
    
    $next = $calculator->resolveCurrentOrUpcomingOccurrence();
    // Returns the next occurrence as array with start and end timestamps like ['start' => 1711922400, 'end' => 1711926000]
    
    $description = $calculator->toText();
}

bash
php vendor/bin/contao-console are:migrate-recurrences