adachsoft / content-source-contracts
Dependency-free PHP contracts and value objects for retrieving source documents about domain entities.
Package info
gitlab.com/a.adach/content-source-contracts
pkg:composer/adachsoft/content-source-contracts
Requires
- php: ^8.3
Requires (Dev)
- adachsoft/php-code-style: ^0.7.3
- friendsofphp/php-cs-fixer: ^3.95
- phpstan/phpstan: ^2.3
- phpunit/phpunit: ^12.5
- rector/rector: ^2.8
- symplify/phpstan-rules: ^14.19
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
A dependency-free PHP library that defines contracts and value objects for retrieving source documents about domain entities. It lets applications integrate multiple source providers behind a consistent API.
Features
SourceProviderInterfacefor identifying providers, checking entity support, and fetching source documents.EntityRefDtofor describing domain entities and their provider-specific identifiers.SourceDocumentDtofor source text and provenance metadata, including a validated trust score.SourceDocumentCollectionfor immutable, ordered document results.
Installation
composer require adachsoft/content-source-contracts
Requirements
- PHP 8.3 or later
The package has no runtime dependencies.
Usage
Implement SourceProviderInterface for each source you want to connect. Pass an EntityRefDto and locale to fetch() and return a SourceDocumentCollection. See the provider example for a complete implementation.