adachsoft / calendar-contracts
PHP contracts and immutable models for calendars, entries, recurrence-aware queries, repositories, access policies, and change notifications.
Requires
- php: ^8.3
- adachsoft/recurrence-contracts: ^0.1
- adachsoft/reference-contracts: ^0.1
Requires (Dev)
- adachsoft/php-code-style: ^0.7.3
- friendsofphp/php-cs-fixer: ^3.95
- phpstan/phpstan: ^2.3
- phpunit/phpunit: ^13.4
- rector/rector: ^2.8
- symplify/phpstan-rules: ^14.19
Suggests
- phpunit/phpunit: Required to run the reusable repository contract tests from testing/
Provides
None
Conflicts
None
Replaces
None
README
This library defines PHP contracts and immutable models for calendars and their entries. It provides repository interfaces, in-memory repositories for tests and development, access-policy and change-listener contracts, and recurrence-aware date ranges. It does not include a production storage adapter or calendar-service implementation.
Features
- Calendar and entry DTOs, identifiers, and validated collections.
- Repository contracts with optimistic concurrency and range queries.
- Access policy, service, and change notification interfaces.
- Reusable repository contract test suites for adapter packages.
- Compatibility with
adachsoft/reference-contractsandadachsoft/recurrence-contracts.
Requirements
- PHP 8.3 or later
adachsoft/reference-contractsadachsoft/recurrence-contracts
Installation
Install with Composer:
composer require adachsoft/calendar-contracts
Usage
Create calendar and entry models and persist them through CalendarRepositoryInterface and EntryRepositoryInterface. Use DateRange to query repository candidates for a local day, week, or month. The in-memory repositories are useful for tests and lightweight development, but do not persist data beyond the current process.
See Basic usage for a complete example. Application services and occurrence expansion are provided by adachsoft/calendar. Adapter packages can extend the contract suites under testing/.