PHP code example of maxwellmandela / php-recurrence

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

    

maxwellmandela / php-recurrence example snippets


use Reccurence\Schedule;

$timezone    = 'Africa/Nairobi';
$schedule = new Schedule($timezone);

$events = $schedule->createEvents([
    'start' => '2019-07-01 00:00:00',
    'end'   => '2019-07-31 00:00:00',
    'interval' => 2,

    // for weekly events, you can change this to either  MONTHLY|YEARLY|DAILY|HOURLY
    // read more here: https://tools.ietf.org/html/rfc5545 for all valid frequencies
    'freq' => 'WEEKLY',
]);

$events = $schedule->createEvents([
    'start' => '2019-07-01 00:00:00',
    'end'   => '2019-07-31 00:00:00',
    'interval' => 2,
    'freq' => 'WEEKLY',

    // for an event recurring 3 times(recurrence_count) every(interval)  2 weeks(freq)
    'recurrence_count' => 3,
]);

composer