simshaun/recurr
PHP library for RFC5545 RRULE recurrence rules. Build rules from strings or fluent setters, then transform them into DateTime occurrences via transformers. Useful for calendars and recurring events with time zone support.
Carbon (via \DateTime compatibility) for timezone-aware operations.Artisan::schedule) or queue workers for time-based jobs.recurrence_rule column as JSON/text).composer require simshaun/recurr and instantiate the Rule/Transformer classes."FREQ=MONTHLY;COUNT=12") or programmatic builders (fluent methods like setFreq()).RecurrenceCollection (Doctrine ArrayCollection subclass) with DateTime objects, enabling easy iteration or storage.json_encode($rule->getString())) or stored as objects (e.g., using Laravel’s Encrypter for sensitive rules).enableLastDayOfMonthFix()) for edge cases. Mitigation: Document and test edge cases early.ArrayTransformerConfig to set custom limits or lazy-load recurrences.new \DateTimeZone('UTC')). Mitigation: Enforce timezone consistency in Laravel config (e.g., config('app.timezone')).Carbon could replace \DateTime for consistency (requires minor wrapper).freq, interval, until)?COUNT=12 to UNTIL=...)?RecurrenceGenerated event)?recurrence_rule column).\DateTime with Carbon for Laravel-native timezone handling (requires minimal wrapper).GenerateRecurrencesJob).RecurrenceGenerated, RecurrenceUpdated).startsBetween for date-range queries).spatie/laravel-calendar for UI.spatie/laravel-invoices for subscription management.laravel-scheduler for time-based tasks.Event) with recurrence support.recurrence_rule column (text/json) to relevant tables.public function getRecurrences(): RecurrenceCollection {
$rule = new Rule($this->recurrence_rule, $this->start_date);
return (new ArrayTransformer())->transform($rule);
}
RecurrenceService to centralize logic (e.g., filtering, generation).FREQ, inputs for COUNT/UNTIL)./events?start_after=2023-01-01).DateTime methods.app.timezone matches the package’s timezone (or override per rule).Rule/Transformer in a service layer.Event::whereRecurrenceStartsBetween(...)).composer.json (e.g., ^2.0) to avoid surprises.How can I help you explore Laravel packages today?