PHP code example of daliendev / laravel-zap-rrule

1. Go to this page and download the library: Download daliendev/laravel-zap-rrule 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/ */

    

daliendev / laravel-zap-rrule example snippets


use Zap\Facades\Zap;

// Every Monday, Wednesday, Friday
Zap::for($user)
    ->named('Standup')
    ->from('2025-01-06')->to('2025-12-31')
    ->addPeriod('09:00', '09:30')
    ->rrule('FREQ=WEEKLY;BYDAY=MO,WE,FR')
    ->save();

// 1st and 15th of every month
Zap::for($user)
    ->named('Billing run')
    ->from('2025-01-01')->to('2025-12-31')
    ->addPeriod('10:00', '11:00')
    ->rrule('FREQ=MONTHLY;BYMONTHDAY=1,15')
    ->save();

// First Monday of every month
Zap::for($user)
    ->named('Monthly review')
    ->from('2025-01-01')
    ->addPeriod('14:00', '15:00')
    ->rrule('FREQ=MONTHLY;BYDAY=1MO')
    ->save();

// Every 2 weeks on Tuesday (DTSTART derived from start_date)
Zap::for($user)
    ->named('Biweekly sync')
    ->from('2025-01-07')->to('2025-12-31')
    ->addPeriod('14:00', '15:00')
    ->rrule('FREQ=WEEKLY;INTERVAL=2;BYDAY=TU')
    ->save();

// app/Models/Schedule.php
use ZapRRule\Models\Schedule as RRuleSchedule;

class Schedule extends RRuleSchedule
{
    // your customizations
}

'models' => [
    'schedule' => App\Models\Schedule::class,
],