PHPackages                             kanel/specification - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. kanel/specification

ActiveLibrary

kanel/specification
===================

An implementation of the Specification design pattern

1.0.0(8y ago)021MITPHPPHP &gt;=7.0.0

Since Jul 13Pushed 8y agoCompare

[ Source](https://github.com/elkaadka/Specification)[ Packagist](https://packagist.org/packages/kanel/specification)[ RSS](/packages/kanel-specification/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

[![build](https://camo.githubusercontent.com/630aec49735e4f8332edf0906d93d7bb29e439a7d76bf9751417f77374fc0062/68747470733a2f2f7472617669732d63692e6f72672f656c6b6161646b612f53706563696669636174696f6e2e7376673f6272616e63683d6d6173746572)](https://camo.githubusercontent.com/630aec49735e4f8332edf0906d93d7bb29e439a7d76bf9751417f77374fc0062/68747470733a2f2f7472617669732d63692e6f72672f656c6b6161646b612f53706563696669636174696f6e2e7376673f6272616e63683d6d6173746572)

Specification design pattern
============================

[](#specification-design-pattern)

Implementation of the "Specification" design pattern.

The Goal of this pattern is to have separate classes of logic in order to do condition composition without rewriting and maintaining the conditions at different places.

How to
------

[](#how-to)

All the classes should extend Kanel/Specification (abstract class)

```
$isAvailable = new isProductAvailable();
$isShippable = new isProductShippable();
$isOnSale = new isProductOnSale();

```

Then perform a composition of specification

```
$specification = $isAvailable->and($isOnSale)->xor($isShippable);

if ($specification->isSatisfiedBy($product)) {

}

```

Available operators :
---------------------

[](#available-operators-)

- and
- or
- xor
- not

If you look for another implementation of the specification design pattern look at **kanel/specifications2**

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3228d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3215e882ee8ae39a8b904d0958420f68bf23b2cf0e22175d5a61513f98e6ef64?d=identicon)[elkaadka](/maintainers/elkaadka)

---

Top Contributors

[![elkaadka](https://avatars.githubusercontent.com/u/24205608?v=4)](https://github.com/elkaadka "elkaadka (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kanel-specification/health.svg)

```
[![Health](https://phpackages.com/badges/kanel-specification/health.svg)](https://phpackages.com/packages/kanel-specification)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
