PHPackages                             oldcodefork/coduo-php-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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. oldcodefork/coduo-php-matcher

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

oldcodefork/coduo-php-matcher
=============================

PHP Matcher enables you to match values with patterns

6.0.13(3y ago)02.3kMITPHP ^7.4.2 || ~8.0 || ~8.1 || ~8.2

Since May 8Pushed 3y agoCompare

[ Source](https://github.com/oldcodefork/coduo-php-matcher)[ Packagist](https://packagist.org/packages/oldcodefork/coduo-php-matcher)[ RSS](/packages/oldcodefork-coduo-php-matcher/feed)WikiDiscussions oldcodefork-phpunit9 Synced yesterday

READMEChangelog (1)Dependencies (5)Versions (75)Used By (0)

PHP Matcher
===========

[](#php-matcher)

[![Type Coverage](https://camo.githubusercontent.com/0da974ed03a339fa649dde3487f9f913800a7fc3dc8cd16374064aafb4873333/68747470733a2f2f73686570686572642e6465762f6769746875622f636f64756f2f7068702d6d6174636865722f636f7665726167652e737667)](https://shepherd.dev/coduo/php-matcher)

Library created for testing all kinds of JSON/XML/TXT/Scalar values against patterns.

API:

```
PHPMatcher::match($value = '{"foo": "bar"}', $pattern = '{"foo": "@string@"}') : bool;
PHPMatcher::backtrace() : Backtrace;
PHPMatcher::error() : ?string;
```

It was built to simplify API's functional testing.

- [![Test Suite](https://github.com/coduo/php-matcher/actions/workflows/test-suite.yml/badge.svg?branch=6.x)](https://github.com/coduo/php-matcher/actions/workflows/test-suite.yml) - [6.x README](https://github.com/coduo/php-matcher/tree/6.x/README.md) PHP &gt;= 7.4 &lt;= 8.1
- [![Build Status](https://github.com/coduo/php-matcher/workflows/Tests/badge.svg?branch=5.x)](https://github.com/coduo/php-matcher/actions?query=workflow%3ATests) - [5.x README](https://github.com/coduo/php-matcher/tree/5.x/README.md) PHP &gt;= 7.2 &lt; 8.0
- [![Build Status](https://github.com/coduo/php-matcher/workflows/Tests/badge.svg?branch=5.0)](https://github.com/coduo/php-matcher/actions?query=workflow%3ATests) - [5.0 README](https://github.com/coduo/php-matcher/tree/5.0/README.md) PHP &gt;= 7.2 &lt; 8.0
- [![Build Status](https://camo.githubusercontent.com/a9bd95113d05041b1bb14b8a19f059e9fc67eed42469eb30bfe28e5df001fb41/68747470733a2f2f7472617669732d63692e6f72672f636f64756f2f7068702d6d6174636865722e7376673f6272616e63683d342e30)](https://travis-ci.org/coduo/php-matcher) - [4.0.\* README](https://github.com/coduo/php-matcher/tree/4.0/README.md) PHP &gt;= 7.2 &lt; 8.0
- [![Build Status](https://camo.githubusercontent.com/64870a855aa20845cf37853e50d16b424515616979258d096ea731f6d3f836fc/68747470733a2f2f7472617669732d63692e6f72672f636f64756f2f7068702d6d6174636865722e7376673f6272616e63683d332e32)](https://travis-ci.org/coduo/php-matcher) - [3.2.\* README](https://github.com/coduo/php-matcher/tree/3.2/README.md) PHP &gt;= 7.0 &lt; 8.0
- [![Build Status](https://camo.githubusercontent.com/eb37b055d3be929e83ff64473faf99183b26c0d545c351d97426923f0877e33c/68747470733a2f2f7472617669732d63692e6f72672f636f64756f2f7068702d6d6174636865722e7376673f6272616e63683d332e31)](https://travis-ci.org/coduo/php-matcher) - [3.1.\* README](https://github.com/coduo/php-matcher/tree/3.1/README.md) PHP &gt;= 7.0 &lt; 8.0

[![Latest Stable Version](https://camo.githubusercontent.com/41f8643ffa4b74d5bb783d646644a0a457f3065b55a901ff529c40af0eeef0bf/68747470733a2f2f706f7365722e707567782e6f72672f636f64756f2f7068702d6d6174636865722f762f737461626c65)](https://packagist.org/packages/coduo/php-matcher)[![Total Downloads](https://camo.githubusercontent.com/673a6b7bf358593e548880d6464dcab757c517490f0a832a6d1f20b99800122a/68747470733a2f2f706f7365722e707567782e6f72672f636f64756f2f7068702d6d6174636865722f646f776e6c6f616473)](https://packagist.org/packages/coduo/php-matcher)[![Latest Unstable Version](https://camo.githubusercontent.com/931c22040f5856c98995639aadb0c796da9a1759de383da0011e5a57960a71fd/68747470733a2f2f706f7365722e707567782e6f72672f636f64756f2f7068702d6d6174636865722f762f756e737461626c65)](https://packagist.org/packages/coduo/php-matcher)[![License](https://camo.githubusercontent.com/fcb2ab57d83c5472718cbceb52f2f85ca806e2772843ae518024af308c8f4a6c/68747470733a2f2f706f7365722e707567782e6f72672f636f64756f2f7068702d6d6174636865722f6c6963656e7365)](https://packagist.org/packages/coduo/php-matcher)

Sandbox
-------

[](#sandbox)

Feel free to play first with [Sandbox](https://php-matcher.norbert.tech/)

Installation
------------

[](#installation)

Require new dev dependency using composer:

```
composer require --dev "coduo/php-matcher"

```

Basic usage
-----------

[](#basic-usage)

### Direct PHPMatcher usage

[](#direct-phpmatcher-usage)

```
