PHP code example of tanthammar / recurring

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

    

tanthammar / recurring example snippets


protected $casts = [
    'start_at'  => 'immutable_date', // duration, not last recurrence
    'timezone' => 'string', //

class DatePattern extends Model
{
    use IsRecurring;
    //...
}

$dp = App\Models\DatePattern::first();

$dp->recurr()->first(): bool|Recurrence
$dp->recurr()->firstStart(): bool|Carbon
$dp->recurr()->firstEnd(): bool|Carbon

$dp->recurr()->last(): bool|Recurrence
$dp->recurr()->lastStart(): bool|Carbon
$dp->recurr()->lastEnd(): bool|Carbon

$dp->recurr()->next(): bool|Recurrence
$dp->recurr()->nextStart(): bool|Carbon
$dp->recurr()->nextEnd(): bool|Carbon

$dp->recurr()->current(): bool|Recurrence
$dp->recurr()->currentStart(): bool|Carbon
$dp->recurr()->currentEnd(): bool|Carbon

$dp->recurr()->rule(): Rule

$dp->recurr()->all(): RecurrenceCollection, //limited to 732 recurrences

$dp->recurr()->schedule(?int $count): RecurrenceCollection

$dp->recurr()->scheduleBetween(string|DateTime $startDate, string|DateTime $endDate, ?int $count): RecurrenceCollection

$dp->recurr()->scheduleBefore(string|DateTime $beforeDate, ?int $count): RecurrenceCollection

$dp->recurr()->scheduleAfter(string|DateTime $afterDate, ?int $count): RecurrenceCollection