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

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

zweifisch/match
===============

pattern matching for php

v0.0.3(12y ago)926MITPHPPHP &gt;=5.4.0

Since Jun 22Pushed 12y ago1 watchersCompare

[ Source](https://github.com/zweifisch/php-pattern-matching)[ Packagist](https://packagist.org/packages/zweifisch/match)[ Docs](https://github.com/zweifisch/php-pattern-matching)[ RSS](/packages/zweifisch-match/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

match [![Build Status](https://camo.githubusercontent.com/ed1aef6a64727b5d719cddde3a38c49960c9f995a00c8ff0092d2389836b1976/68747470733a2f2f7472617669732d63692e6f72672f7a77656966697363682f7068702d7061747465726e2d6d61746368696e672e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/zweifisch/php-pattern-matching)
===============================================================================================================================================================================================================================================================================================================================

[](#match-)

pattern matching for php

install via composer

```
composer require 'zweifisch/match:*'
```

destruct value

```
$array = [1,[2,[3,4]]];
extract(\match\destruct(['a',['b',['c','d']]], $array)) or die("match failed");
echo "$a $b $c $d"; // "1 2 3 4"
```

passing to a function

```
$input = ['method'=>'foo', 'params'=>['bar']];
$pattern = ['method'=>'func', 'params'=>['arg1']];
$result = \match\let($pattern, $input, function($arg1, $func){
	return "$func $arg1";
});
// "foo bar"
```

destruct multiple values

```
$input = ['method'=>'foo', 'params'=>['bar']];
$result = \match\let(
	['method'=>'func', 'params'=>['arg1']], $input
	'now', time(),
	function($func, $arg1, $now){
		return "$func $arg1 $now";
	}
);
```

tests
-----

[](#tests)

```
composer install --dev
vendor/bin/phpunit -c tests
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

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

Total

3

Last Release

4637d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cdbb731edddfc89091983a03b73a05e286cbb966fcdb300758f157f327f0274f?d=identicon)[zf](/maintainers/zf)

---

Top Contributors

[![zweifisch](https://avatars.githubusercontent.com/u/447862?v=4)](https://github.com/zweifisch "zweifisch (5 commits)")

---

Tags

Pattern Matching

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[functional-php/pattern-matching

Pattern matching for PHP with automatic destructuring.

8261.5k](/packages/functional-php-pattern-matching)[spiral/mcp-server

Spiral bridge for MCP server

541.1k2](/packages/spiral-mcp-server)

PHPackages © 2026

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