adachsoft / recurrence-contracts
Interfaces, value objects and data transfer objects for recurrence rules and occurrence calculation.
Requires
- php: ^8.3
Requires (Dev)
- adachsoft/php-code-style: ^0.7
- friendsofphp/php-cs-fixer: ^3.95
- phpstan/phpstan: ^2.3
- phpunit/phpunit: ^13.4
- rector/rector: ^2.8
- symplify/phpstan-rules: ^14.19
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
A dependency-free PHP library of value objects and interfaces for defining recurrence rules and calculated occurrences. It provides the contracts for recurrence models, occurrence calculation, and rule serialization without imposing a storage or serialization format.
Features
- Immutable recurrence rule and occurrence value objects.
- Recurrence frequencies, local wall-clock times, weekday selectors, and end conditions.
- Interfaces for occurrence calculators and rule normalizers, allowing application-specific implementations.
Requirements
- PHP 8.3 or later.
Installation
composer require adachsoft/recurrence-contracts
Usage
Use the rule DTOs to represent recurrence data in your application. Implement OccurrenceCalculatorInterface to calculate occurrences and RecurrenceRuleNormalizerInterface with a RuleTypeNormalizerInterface implementation to normalize rules for your chosen persistence or transport format. This package defines these contracts but does not include calculator or normalizer implementations.
See the usage example for constructing rules.