Search by

adachsoft / principal-contact-contracts

Arkadiusz Adach

Provider-independent PHP contracts and models for storing contact points belonging to principals.

Package info

gitlab.com/a.adach/principal-contact-contracts

Issues

pkg:composer/adachsoft/principal-contact-contracts

Statistics

Installs: 7

Dependents: 1

Suggesters: 0

Stars: 0

v0.1.0 2026-11-25 00:24 UTC

This package is auto-updated.

Last update: 2026-11-24 23:24:19 UTC


README

Provider-independent PHP contracts and models for contact points belonging to principals such as users, accounts, or groups. The package keeps contact information separate from authentication and application-specific principal implementations.

Features

  • Contact channel, contact point, and principal contact models.
  • Repository, service, validation, access-policy, and change-listener interfaces.
  • An in-memory repository with optimistic version checks.
  • A reusable PHPUnit repository contract test for storage adapters.

This package does not provide a persistent storage adapter or a service implementation.

Requirements

  • PHP 8.3 or newer.
  • Composer for dependency installation.

Installation

composer require adachsoft/principal-contact-contracts

Composer installs the package's runtime dependencies.

Usage

See the contact points example for creating and querying contact point collections.

Integration

Implement PrincipalContactsRepositoryInterface for your storage backend and use ContactServiceInterface to define application operations. Contact channels are open identifiers: email and phone are provided, and applications may define their own. ContactPointCollection preserves insertion order, prevents duplicate channel/value pairs and multiple primary points for the same channel, and provides channel filtering and primary-point lookup.

An in-memory repository is included for simple use and as a reference implementation. Adapter authors can extend AbstractPrincipalContactsRepositoryContractTest from the AdachSoft\\PrincipalContactContracts\\Testing namespace to check repository behavior.

See the contact points example for a usage sample. See the repository contract test example for adapter integration.