fragoe/php-specifications

Specification pattern by Eric Evans and Martin Fowler (2002, "Specifications", martinfowler.com/apsupp/spec.pdf).

Maintainers

Package info

github.com/fragoe/php-specifications

pkg:composer/fragoe/php-specifications

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.0 2026-04-12 15:10 UTC

This package is auto-updated.

Last update: 2026-04-12 15:19:34 UTC


README

Tests codecov PHP Version License

A PHP implementation of the Specification pattern by Eric Evans and Martin Fowler (2002).

Specifications are business rules represented as predicates. Composable specifications can be combined using logical operators (and, or, xor, not).

Requirements

  • PHP ^8.1

Installation

composer require fragoe/php-specifications

Usage

Use Specification when you only need a simple predicate with one method (isSatisfiedBy()).

Use ComposableSpecification for fluent composition methods (and(), or(), xor(), not()). In most cases, extend AbstractComposableSpecification to get those methods by default.

See the tests for practical examples.

Contributing

See CONTRIBUTING.md for compatibility policy details.

License

MIT