PHPackages                             sourcepot/match - 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. sourcepot/match

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

sourcepot/match
===============

PHP class providing a match object

v1.6.5(1mo ago)0811MITPHPPHP &gt;=8.0

Since Feb 4Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/SourcePot/match)[ Packagist](https://packagist.org/packages/sourcepot/match)[ Docs](https://datapool.info)[ RSS](/packages/sourcepot-match/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (24)Used By (1)

The PHP classes in this repository allow complex data values such as patent numbers, dates and times etc. to be matched. In order to do this, in a first step the data value to be compared with as well as the match type needs to be loaded. After this the method mprepareMatch() returns a needle. Depending on the match type, this needle can be used for database pre-filtering to create a haystack of data values from the database. In the last step the matches are performed between the initially loaded data value and the haystack values. Each match provides a match probability in the range 0...1, with 1 → complete match and 0 → no match.

Installation
============

[](#installation)

You can use Packagist to install the package on a web server or your local computer, e.g. *Command Prompt*, enter `composer create-project sourcepot/asset {add your target directory here}`.

Features
--------

[](#features)

- Simple and complex value matches, from simple string contain to UNYCOM cases
- Extraction of a 'needles' from the input value used to pre-filter database entries and create a haystack
- Returns a match probability 0...1 for the input value compared with entries of the haystack

Sample code
===========

[](#sample-code)

In the following example source code the UNYCOM case number “2015P45527WEPL122” is extracted from the string “q2015P45527WEPL12” and loaded to the match object as the match value for a UNYCOM match.

```

```

Match types, examples
=====================

[](#match-types-examples)

Caution

The actual match result value might depend on the version of this package and related packages. The match strategie or weights might be adjusted over time.

String chunk match
------------------

[](#string-chunk-match)

The following example uses strings whose sub-strings or components are separated by semicolons. Possible separators are defined by the regular expression `[\{\}\[\]\(\)\'";,|\/\\.\s]+`, which is defined as a constant. The 2nd sub-string is used as needle, the weight nearly halfs from chunk to chunk, i.e. the 1st chunk weight=50%, the 2nd 25%,....

haystack valueto match valueneedlematch2024-11-23;72661;ABCDEF2024-11-23;72661;ABCDEF%72661%12024-11-22;72661;ABCDEF2024-11-23;72661;ABCDEF%72661%0.432024-11-23;72660;ABCDEF2024-11-23;72661;ABCDEF%72660%0.712024-11-22;72661;ABCDEF2024-11-23;72661;ABCDEF%72660%0.432024-11-22;72660;ABCdEF2024-11-23;72661;ABCDEF%72660%0Patent case
-----------

[](#patent-case)

For this match, the patent or application number is broken down into two components: Country code and intellectual property right number. A check digit is ignored and a possible year as prefix is accepted with 2 or 4 digits, e.g. 09 == 2009 == 1909 etc.

Example: EP **20**09 716 604 **.5** → Country code: `EP` and Number: `09716604`

haystack valueto match valueneedlematchPCT/EP2009/055033PCT/EP2009/055033%033%1PCT/EP09/055033PCT/EP2009/055033%033%1PCT/09/055033PCT/EP2009/055033%033%0PCT/US09/055033PCT/EP2009/055033%033%0PCT/EP2009/055043PCT/EP2009/055033%043%0EP09716604.5EP 09 716 604.5%604%1EP09716604EP 09 716 604.5%604%1EP2009716604EP 09 716 604.5%604%1EP209716604EP 09 716 604.5%604%0EP2009516604EP 09 716 604.5%604%0EP 09 716 604.5%604%0EP 09 716 604.5!INVALID\_NEEDLE!0UNYCOM case
-----------

[](#unycom-case)

A weight is assigned to each of the components of the UNYCOM case number (year, file type, number, region, country and part). The weights are defined as constants in the `SourcePot\Match\UNYCOM` class and can be customised to your own requirements.

haystack valueto match valueneedlematch2009P53143WECZ032009P53143WECZ03%53143%12019P53143WECZ032009P53143WECZ03%53143%0.82009XP53143WECZ032009P53143WECZ03%53143%0.92009P52143WECZ032009P53143WECZ03%53143%0.62009P53143EPCZ032009P53143WECZ03%53143%0.92009P53143WEDE032009P53143WECZ03%53143%0.92009P53143WECZ022009P53143WECZ03%53143%0.92009P53143WECZ2009P53143WECZ03%53143%0.92009P53143EP2009P53143WECZ03%53143%0.72008P52143EP2009P53143WECZ03%53143%0.12008F521432009P53143WECZ03%53143%0DateTime
--------

[](#datetime)

Note

The needle will be based on the database timezone.

haystack valueto match valueneedlematch2023-07-11 11.13am (Europe/London)2023-07-11 12:13Uhr (Europe/Berlin)2023-07-11%12023-07-13July 13, 20232023-07-13%12023-07-13July 13, 2023 2.00pm2023-07-13%02023-07-11July 13, 2023 2.00pm2023-07-11%0Identical
---------

[](#identical)

haystack valueto match valueneedlematch100095646\\chä6477/测试,用例(Hallo)Test100095646\\chä6477/测试,用例(Hallo)Test%100095646\\chä6477/测试,用例(Hallo)Test%1100095646\\ch6477/测试,用例(Hallo)Test100095646\\chä6477/测试,用例(Hallo)Test%100095646\\chä6477/测试,用例(Hallo)Test%0Contains / Contains (ci)
------------------------

[](#contains--contains-ci)

`(ci)` is the case insensitive match type.

haystack valueto match valueneedlematch100095646\\chä6477/测试,用例(Hallo)Test100095646\\chä6477/测试,用例(Hallo)Test%ä6477/测试,用%1100095646\\ch6477/测试,用例(Hallo)Test100095646\\chä6477/测试,用例(Hallo)Test%ä6477/测试,用%0100095646\\chä6477/测试,用例100095646\\chä6477/测试,用例(Hallo)Test%ä6477/测试,用%1Does not contain / Does not contain (ci)
----------------------------------------

[](#does-not-contain--does-not-contain-ci)

`(ci)` is the case insensitive match type.

haystack valueto match valueneedlematch100095646\\chä6477/测试,用例(Hallo)Test100095646\\chä6477/测试,用例(Hallo)Test0100095646\\ch6477/测试,用例(Hallo)Test100095646\\chä6477/测试,用例(Hallo)Test1100095646\\chä6477/测试,用例100095646\\chä6477/测试,用例(Hallo)Test0Correlation contains
--------------------

[](#correlation-contains)

haystack valueto match valuematch100095646\\chä6477/测试,用例(Hallo)Test100095646\\chä6477/测试,用例(Hallo)Test1100095646\\ch6477/测试,用例(Hallo)Test100095646\\chä6477/测试,用例(Hallo)Test0.6969696969697100095646\\chä6477/测试,用例100095646\\chä6477/测试,用例(Hallo)Test1Correlation match
-----------------

[](#correlation-match)

haystack valueto match valuematch100095646\\chä6477/测试,用例(Hallo)Test100095646\\chä6477/测试,用例(Hallo)Test1100095646\\ch6477/测试,用例(Hallo)Test100095646\\chä6477/测试,用例(Hallo)Test0.67647058823529100095646\\chrt477/测试,用例(Hallo)Test100095646\\chä6477/测试,用例(Hallo)Test0.94117647058824100095646\\chä6477/测试,用例100095646\\chä6477/测试,用例(Hallo)Test0.67647058823529Integer match
-------------

[](#integer-match)

haystack valueto match valuematch10009564610009564611000956471000956460.999999990009562000956471000956460.5002389982026911000956460Float match
-----------

[](#float-match)

haystack valueto match valuematch1.454341.454,34e-311.454351.454,34e-30.9999931240760514.54341.454,34e-30.1145.4341.454,34e-30.01Evaluation web page
===================

[](#evaluation-web-page)

An evaluation web page is provided with this package. Here is a screenshot of the evaluation web page: [![Evaluation web page](./assets/evaluation-page.png)](./assets/evaluation-page.png)

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance88

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

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 ~18 days

Recently: every ~58 days

Total

23

Last Release

59d ago

Major Versions

v0.0.3 → v1.0.02025-02-06

### Community

Maintainers

![](https://www.gravatar.com/avatar/203fc800c6762aad4804f2e278a35262e603691a057035ff200827499e53f434?d=identicon)[SourcePot](/maintainers/SourcePot)

---

Top Contributors

[![SourcePot](https://avatars.githubusercontent.com/u/115737488?v=4)](https://github.com/SourcePot "SourcePot (87 commits)")

---

Tags

Match

### Embed Badge

![Health badge](/badges/sourcepot-match/health.svg)

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

###  Alternatives

[longman/ip-tools

PHP IP Tools for manipulation with IPv4 and IPv6

147245.6k6](/packages/longman-ip-tools)[nzedb/nzedb

A Usenet Indexer

6415.4k](/packages/nzedb-nzedb)[chippyash/monad

Functional programming Monad support

2828.1k8](/packages/chippyash-monad)

PHPackages © 2026

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