PHPackages                             boyhagemann/matcher - 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. boyhagemann/matcher

ActiveLibrary

boyhagemann/matcher
===================

061PHP

Since Jan 2Pushed 12y ago1 watchersCompare

[ Source](https://github.com/boyhagemann/Matcher)[ Packagist](https://packagist.org/packages/boyhagemann/matcher)[ RSS](/packages/boyhagemann-matcher/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Matcher
=======

[](#matcher)

With Matcher you can match an object to specified rules and get data returned.

### Example usage

[](#example-usage)

```
// Add some rules
$matcher->whenProperty('title')->contains('Hi')->provide(['foo' => 'bar']);

// Get an object to match against
$object = Your\Object;
$object->title = 'Hi';

// Check if the object matches the rules
$data = $matcher->match($object); // Will return "array(array('foo' => 'bar'))"
```

### Rule logic

[](#rule-logic)

Every rule can match using different logics. For now, these are the implemented logics:

```
// Applied the a Rule object
$rule->equals('foo'); // Default logic
$rule->startsWith('foo');
$rule->endsWith('foo');
$rule->contains('foo');

//Applied to a Container object using the fluent interface
$matcher->whenProperty('title')->equals('foo');
$matcher->whenProperty('title')->startsWith('foo');
$matcher->whenProperty('title')->endsWith('foo');
$matcher->whenProperty('title')->contains('foo');
```

Documentation will be updated with:

- Using tags
- Unique fields
- Match logic explained
- Match against multiple values
- Setting default values
- Helpful scenarios when you can use this library

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/2a43699bf9428b2ee2e827915e14321f44c4cb7e6fbf4c6a3faf086937a852ce?d=identicon)[boyhagemann](/maintainers/boyhagemann)

---

Top Contributors

[![boyhagemann](https://avatars.githubusercontent.com/u/737610?v=4)](https://github.com/boyhagemann "boyhagemann (3 commits)")

### Embed Badge

![Health badge](/badges/boyhagemann-matcher/health.svg)

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

PHPackages © 2026

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