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

ActiveLibrary

legalthings/permission-matcher
==============================

A permission matcher for PHP

0.1(9y ago)0140↓50%MITPHPPHP &gt;=5.6.0

Since May 9Pushed 8y ago8 watchersCompare

[ Source](https://github.com/legalthings/permission-matcher)[ Packagist](https://packagist.org/packages/legalthings/permission-matcher)[ RSS](/packages/legalthings-permission-matcher/feed)WikiDiscussions master Synced 2mo ago

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

Legal Things - Permission matcher
=================================

[](#legal-things---permission-matcher)

With the permission matcher library, you can check whether a user is allowed to have access to specific resources. Specifying resources and access control levels is up to the client of the library.

Requirements
------------

[](#requirements)

- [PHP](http://www.php.net) &gt;= 5.6.0

*Required PHP extensions are marked by composer*

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

[](#installation)

The library can be installed using composer.

```
composer require legalthings/permission-matcher

```

How it works
------------

[](#how-it-works)

The library exposes one function with which you can get a list of privileges for matching authz groups. Authz groups can be anything you want, in the example below resource URIs are used, but you could also use a string of any format. In the example we have a user that has certain permissions attached to him. We can then ask the `PermissionMatcher` class to extract the permissions of the users for a given authz group. Note that you can use wildcards `*`. You can also invert a permission by placing a `!` in front of the authz group.

```
$matcher = new PermissionMatcher();

$permissionsThatSomeUserHas = [
    '/organizations/0001' => ['full-access'],
    '/organizations/0002?list=all' => 'list',
    '/organizations/0003/*/foo' => ['read', 'write']
];

echo $matcher->match($permissionsThatSomeUserHas, ['/organizations/0001']);
// outputs ['full-access']

echo $matcher->match($permissionsThatSomeUserHas, ['/organizations/0001', '/organizations/0003/random/foo']);
// outputs ['full-access', 'read', 'write']

echo $matcher->match($permissionsThatSomeUserHas, ['/organizations/0002']);
// outputs []

echo $matcher->match($permissionsThatSomeUserHas, ['/organizations/0002?list=all']);
// outputs ['list']

echo $matcher->match($permissionsThatSomeUserHas, ['/organizations/*']);
// outputs ['full-access', 'read', 'write']
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 58.3% 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 ~248 days

Total

2

Last Release

3407d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3379a93d51305df325df9045e1a8b205d195e4e8c01312dff53a000ee79002eb?d=identicon)[jasny](/maintainers/jasny)

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

---

Top Contributors

[![moesjarraf](https://avatars.githubusercontent.com/u/5793511?v=4)](https://github.com/moesjarraf "moesjarraf (7 commits)")[![svenstm](https://avatars.githubusercontent.com/u/1632578?v=4)](https://github.com/svenstm "svenstm (5 commits)")

### Embed Badge

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

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

PHPackages © 2026

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