PHPackages                             midnight/permissions - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. midnight/permissions

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

midnight/permissions
====================

Simple permissions system

2.0.0(5y ago)021.4k↑95.2%1[1 PRs](https://github.com/MidnightDesign/midnight-permissions/pulls)1MITPHPPHP ^7.4 || ^8.0CI failing

Since Oct 23Pushed 5y ago1 watchersCompare

[ Source](https://github.com/MidnightDesign/midnight-permissions)[ Packagist](https://packagist.org/packages/midnight/permissions)[ RSS](/packages/midnight-permissions/feed)WikiDiscussions master Synced yesterday

READMEChangelog (5)Dependencies (9)Versions (8)Used By (1)

[![Check Build](https://github.com/MidnightDesign/midnight-permissions/actions/workflows/checks.yml/badge.svg)](https://github.com/MidnightDesign/midnight-permissions/actions/workflows/checks.yml)

midnight/permissions
====================

[](#midnightpermissions)

ACL and RBAC weren't the permission models I was looking for. So I wrote my own.

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

[](#installation)

Install `midnight/permissions` via Composer.

Usage
-----

[](#usage)

You need a [Container](https://github.com/php-fig/container) that can provide your `PermissionService`with permissions. In this example, we're going to use `league/container`, but any container implementing `Psr\Container\ContainerInterface` will work.

For brevity, the user and resource are arrays in this example. Most likely, they will be objects any real-world project.

```
class CanDoSomething implements Midnight\Permissions\PermissionInterface
{
    public function isAllowed($user = null, $resource = null): bool {
        return $user === $resource['owner'];
    }
}

$container = new League\Container\Container();
$container->add('can_do_something', CanDoSomething::class);

$permissionService = new Midnight\Permissions\PermissionService($container);

$permissionService->isAllowed('Rudolph', 'can_do_something', ['owner' => 'Rudolph']); // true
$permissionService->isAllowed('Rudolph', 'can_do_something', ['owner' => 'Christoph']); // false
```

Laminas Module
--------------

[](#laminas-module)

There's also a Laminas module that will let you access the `PermissionService` via the Service Manager, add permissions via the config and give you view helpers and controller plugins. It's called [midnight/permissions-module](https://github.com/MidnightDesign/midnight-permissions-module).

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 76.9% 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 ~515 days

Total

5

Last Release

1846d ago

Major Versions

1.2.0 → 2.0.02021-06-13

PHP version history (4 changes)1.0.0PHP &gt;=5.5

1.1.0PHP ^7.1

1.2.0PHP ^7.4

2.0.0PHP ^7.4 || ^8.0

### Community

Maintainers

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

---

Top Contributors

[![MidnightDesign](https://avatars.githubusercontent.com/u/743172?v=4)](https://github.com/MidnightDesign "MidnightDesign (10 commits)")[![rieschl](https://avatars.githubusercontent.com/u/3321556?v=4)](https://github.com/rieschl "rieschl (3 commits)")

---

Tags

permissionpermissionsaccess-control

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/midnight-permissions/health.svg)

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

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k102.4M1.4k](/packages/spatie-laravel-permission)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k3.9M129](/packages/bezhansalleh-filament-shield)[casbin/casbin

a powerful and efficient open-source access control library for php projects.

1.3k1.5M54](/packages/casbin-casbin)[casbin/laravel-authz

An authorization library that supports access control models like ACL, RBAC, ABAC in Laravel.

331368.6k4](/packages/casbin-laravel-authz)[pktharindu/nova-permissions

Laravel Nova Grouped Permissions (ACL)

136421.9k](/packages/pktharindu-nova-permissions)[silvanite/novatoolpermissions

Laravel Nova Permissions (Roles and Permission based Access Control (ACL))

100266.5k2](/packages/silvanite-novatoolpermissions)

PHPackages © 2026

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