PHPackages                             matijabelec/acl-php - 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. matijabelec/acl-php

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

matijabelec/acl-php
===================

Acl

0.2.0(2y ago)216MITPHPPHP &gt;=8.2

Since Aug 12Pushed 2y ago2 watchersCompare

[ Source](https://github.com/matijabelec/acl-php)[ Packagist](https://packagist.org/packages/matijabelec/acl-php)[ RSS](/packages/matijabelec-acl-php/feed)WikiDiscussions master Synced 3d ago

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

acl-php
=======

[](#acl-php)

[![Packagist](https://camo.githubusercontent.com/09020937d511918df52d3c61f9a923b4578425b552e5bb02ca5069eae7f85fac/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6174696a6162656c65632f61636c2d7068702e737667)](https://packagist.org/packages/matijabelec/acl-php)

Custom ACL with role hierarchy (any role can have max. of 1 parent role). Role hierarchy is used to automatically inherit actions allowed for parent(s) roles to selected role. Actions are just strings that describes some action. Roles are, basically, strings that represents types of users (but not limited to).

Examples
========

[](#examples)

Before anything else, create an object of MatijaBelec\\Acl\\Acl class.

```
    use MatijaBelec\Acl\Acl;
    $acl = new Acl();
```

There should be created role hierarchy. It can be created with the following code:

```
    // create role hierarchy
    $acl->addRole('guest');
    $acl->addRole('user', 'guest');
    $acl->addRole('administrator', 'user');
```

After role hierarchy is created, let's add some actions to roles:

```
    // create actions tree
    $acl->allow('guest', 'user.canUpdate');
    $acl->allow('guest', 'user.canDelete');
    $acl->allow('user', 'user.canCreate');
    $acl->deny('user', 'user.canDelete');
    $acl->allow('administrator', ['user.canRead', 'user.canUpdate']);
    $acl->allow('administrator', 'user.canDelete');
```

To check if some role has allowed actions, the following code can be used:

```
    // check actions on user
    $adminIsAllowedToGetUserDetails = $acl->isAllowed('administrator', 'user.canRead');
    $userIsAllowedToCreateNewUser = $acl->isAllowed('user', 'user.canCreate');
```

License
=======

[](#license)

MIT (Matija Belec 2017)

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity68

Established project with proven stability

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

Total

3

Last Release

866d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4ff667fb9440023f42121cd9513290b82a622b0bdfd061cc9eeaab1e7fadd34d?d=identicon)[matijabelec](/maintainers/matijabelec)

---

Top Contributors

[![matijabelec](https://avatars.githubusercontent.com/u/9214092?v=4)](https://github.com/matijabelec "matijabelec (7 commits)")

---

Tags

acl

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/matijabelec-acl-php/health.svg)

```
[![Health](https://phpackages.com/badges/matijabelec-acl-php/health.svg)](https://phpackages.com/packages/matijabelec-acl-php)
```

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k89.8M1.0k](/packages/spatie-laravel-permission)[zizaco/entrust

This package provides a flexible way to add Role-based Permissions to Laravel. Supports laravel 5|6|7|8

6.0k5.3M61](/packages/zizaco-entrust)[santigarcor/laratrust

This package provides a flexible way to add Role-based Permissions to Laravel

2.3k5.4M43](/packages/santigarcor-laratrust)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[casbin/casbin

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

1.3k1.4M54](/packages/casbin-casbin)[nette/security

🔑 Nette Security: provides authentication, authorization and a role-based access control management via ACL (Access Control List)

3839.3M279](/packages/nette-security)

PHPackages © 2026

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