fr3on / php-recur
A modern PHP 8.4+ library for recurring date/time rules (iCal RRULE).
0.0.1
2026-04-13 18:54 UTC
Requires
- php: >=8.4
Requires (Dev)
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^11.5
Suggests
- nesbot/carbon: For Carbon interop with date/time objects.
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).
Features
- PHP 8.4+ Optimized: Leverages modern features like
readonlyclasses, 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.