fr3on/php-recur

A modern PHP 8.4+ library for recurring date/time rules (iCal RRULE).

Maintainers

Package info

github.com/fr3on/php-recur

pkg:composer/fr3on/php-recur

Statistics

Installs: 90

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.0.1 2026-04-13 18:54 UTC

This package is auto-updated.

Last update: 2026-04-13 18:55:55 UTC


README

A modern, high-performance PHP 8.4+ library for recurring date/time rules (iCal RRULE).

CI PHP Version License

Features

  • PHP 8.4+ Optimized: Leverages modern features like readonly classes, enums, and Generators.
  • Lazy Iteration: Processes occurrences one-by-one, making it safe for infinite rules.
  • Timezone Aware: Correctly handles DST transitions across all timezones.
  • RFC 5545 Compliant: Implements the iCal RRULE specification including complex expansion logic.
  • Fluent Builder: Developer-friendly API for common recurrence patterns.

Installation

composer require fr3on/php-recur

Quick Start

Basic Daily Recurrence

use Fr3on\Recur\Recur;

$occurrences = Recur::daily()
    ->starting(new DateTimeImmutable('2026-04-13'))
    ->count(10)
    ->take(10);

Complex Monthly Rule

use Fr3on\Recur\Recur;
use Fr3on\Recur\Rule\Weekday;

// Second Monday of every month
$builder = Recur::monthly()
    ->on(Weekday::MO->nth(2))
    ->take(12);

Parsing RRULE Strings

$builder = Recur::fromRrule("FREQ=WEEKLY;BYDAY=MO,WE,FR;COUNT=10");
foreach ($builder->occurrences() as $date) {
    echo $date->format('Y-m-d');
}

Development

Running Tests

composer test

Static Analysis

composer analyse

License

MIT License. See LICENSE for details.