PHPackages                             danhanly/scientist-utility-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. danhanly/scientist-utility-matcher

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

danhanly/scientist-utility-matcher
==================================

Utility Matchers for Scientist

0.2.0(10y ago)152[1 issues](https://github.com/danhanly/scientist-utility-matcher/issues)MITPHP

Since Feb 7Pushed 10y agoCompare

[ Source](https://github.com/danhanly/scientist-utility-matcher)[ Packagist](https://packagist.org/packages/danhanly/scientist-utility-matcher)[ RSS](/packages/danhanly-scientist-utility-matcher/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (3)Dependencies (2)Versions (4)Used By (0)

[![Scientist](scientist.png)](https://github.com/daylerees/scientist)

Scientist Utility Matchers
==========================

[](#scientist-utility-matchers)

[![Packagist Version](https://camo.githubusercontent.com/23043c433dfa4c2d12a8b41c75d01eee97aa18444d985094cb963d2c28d22721/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f64616e68616e6c792f736369656e746973742d7574696c6974792d6d6174636865722e737667)](https://packagist.org/packages/danhanly/scientist-utility-matcher)[![Packagist](https://camo.githubusercontent.com/6ec8440d1c5f5bd8786e4ad23abab10266e0b85ff1df6c3b3a67a2a2f5290f62/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f64616e68616e6c792f736369656e746973742d7574696c6974792d6d6174636865722e737667)](https://packagist.org/packages/danhanly/scientist-utility-matcher)

Simple type, utility matchers for use with the [Scientist Library](http://github.com/daylerees/scientist)

1. Installation
---------------

[](#1-installation)

Require the latest version of Scientist Symfony using [Composer](https://getcomposer.org/).

```
composer require danhanly/scientist-utility-matcher

```

2. Matchers
-----------

[](#2-matchers)

There are a number of simple matchers packaged within this project, for use with your experiments.

### 2.1 ObjectPropertyMatcher

[](#21-objectpropertymatcher)

This allows you to match specific properties on objects returned with the control and trial processes.

When initialising the matcher, you can configure it to either match against a single property (via string), or multiple properties (via array)

```
// initialise matcher
$matcher = new \DanHanly\Scientist\UtilityMatchers\ObjectPropertyMatcher;
// define property via string
$matcher->setProperties('propertyName');
// or via array
$matcher->setProperties(['propertyName', 'anotherPropertyName']);
```

You can also set properties directly via the matcher constructor.

```
// define property via string
$matcher = new \DanHanly\Scientist\UtilityMatchers\ObjectPropertyMatcher('propertyName');
// or via array
$matcher = new \DanHanly\Scientist\UtilityMatchers\ObjectPropertyMatcher(['propertyName', 'anotherPropertyName']);
```

### 2.2 ArrayKeyMatcher

[](#22-arraykeymatcher)

This allows you to match specific keys on arrays returned with the control and trial processes.

#### 2.2.1 Simple Key Matching

[](#221-simple-key-matching)

When initialising the matcher, you can configure it to either match against a single key (via string), or multiple keys (via array)

```
// initialise matcher
$matcher = new \DanHanly\Scientist\UtilityMatchers\ArrayKeyMatcher;
// define keys via string
$matcher->setKeys('keyName');
// or via array
$matcher->setKeys(['keyName', 'anotherKeyName']);
```

You can also set keys directly via the matcher constructor.

```
// define key via string
$matcher = new \DanHanly\Scientist\UtilityMatchers\ArrayKeyMatcher('keyName');
// or via array
$matcher = new \DanHanly\Scientist\UtilityMatchers\ArrayKeyMatcher(['keyName', 'anotherKeyName']);
```

#### 2.2.2 Deep Key Matching

[](#222-deep-key-matching)

Array deep key matching can be done with the `->` delimiter.

Say for example you wanted to match the zip code of an address, but the address is stored in `$array['data']['user']['address']['zip']`, your matching notation would be `data->user->address->zip`

```
// define key via string
$matcher = new \DanHanly\Scientist\UtilityMatchers\ArrayKeyMatcher('data->user->address->zip');
```

### 2.3 MinMaxMatcher

[](#23-minmaxmatcher)

This allows you to ensure that both the trial values and the control values are within a predefined threshold.

When initialising the matcher, you can configure it to match only those that are greater than a minimum value, those that are less than a maximum value, or a combination of both.

The first parameter is the minimum value, the second parameter is the maximum value.

```
// intialise with a 0 minimum
$matcher = new \DanHanly\Scientist\UtilityMatchers\MinMaxMatcher(0);
// intialise with a 10 maximum
$matcher = new \DanHanly\Scientist\UtilityMatchers\MinMaxMatcher(null, 10);
// intialise between 0 and 10
$matcher = new \DanHanly\Scientist\UtilityMatchers\MinMaxMatcher(0, 10);
```

3. Usage
--------

[](#3-usage)

Once you've initialised and configured your matcher, you can use it within your experiments.

```
$experiment = (new Scientist\Laboratory)
  ->experiment('experiment title')
  ->control($controlCallback)
  ->trial('trial name', $trialCallback)
  ->matcher($matcher);
```

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity55

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

Every ~0 days

Total

3

Last Release

3795d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/82f22872e4513f1718107bfdf797333aee0983978bc8d7015c02cbc5a7e7dbe4?d=identicon)[danhanly](/maintainers/danhanly)

---

Top Contributors

[![danhanly](https://avatars.githubusercontent.com/u/1150741?v=4)](https://github.com/danhanly "danhanly (7 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/danhanly-scientist-utility-matcher/health.svg)

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

###  Alternatives

[grrr-amsterdam/garp-functional

Utility library embracing functional programming paradigms.

32117.6k5](/packages/grrr-amsterdam-garp-functional)

PHPackages © 2026

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