PHPackages                             mattmezza/aclify - 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. mattmezza/aclify

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

mattmezza/aclify
================

A simple and plain ACL component based on a YAML file.

1.0.0(7y ago)5151MITPHPPHP ^7.1

Since Feb 15Pushed 7y ago2 watchersCompare

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

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

[![Build Status](https://camo.githubusercontent.com/4a0ceae869fa79e15e86b0ccdfbda67c1cf3c5cdeb46f69455995260fff1c4af/68747470733a2f2f7472617669732d63692e6f72672f6d6174746d657a7a612f61636c6966792e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/mattmezza/aclify)

aclify
======

[](#aclify)

A simple and plain ACL component based on a YAML file.

Specs
-----

[](#specs)

Aclify is a really simple component that halps you manage roles and abilities for a small set of users.

Have you ever been in the context of a small projects that requires no database, no authentication (cause it is accomplished using an external provider), small set of roles and abilities???

If you have, well, this package is for you.

Aclify allows you to define roles, each with a set of abilities (operations you can do if you belong to the role). It also allows you to specify for each user, a set of roles.

It can be used in a tight way, coupled with your User object representation or it can be also used as an external component you call specifying the user each time.

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

[](#installation)

`composer require mattmezza/aclify`

Usage
-----

[](#usage)

Write down your users and roles with abilities in a YAML file as follows:

```
roles:
  billing:
    - payments
  marketing:
    - mailchimp
    - facebook
  support:
    - cms_tools
users:
  mary:
    - marketing
    - billing
    - support
  gigi:
    - support
```

We specified in this way three roles: `billing` (users with this role can manage the `payments`), `marketing` (users with this role can access to tools like `mailchimp` or `facebook`) and `support` (users with this role can access the `cms_tools`).

Then we specified the users allowed: `mary` is an advanced user, she can check pretty much everything (`marketing`, `support`, `billing`) while `gigi` is a basic user with just the `support` abilities enabled.

### Usage tight to your User object

[](#usage-tight-to-your-user-object)

If you wanna use Aclify tight with your User object representation you can do that by extending the abstract class `Aclify\ACLUser` which forces you to define two methods (user id and acl object retrieval - you can use your project's dependency injection component) and gives you some inherited methods to check whether the `User` can or cannot use some abilities.

Define your User object as follows (you can add your methods to the class):

```
use Aclify\ACL;

class User extends ACLUser
{
    private $acl;
    private $id;
    public function __construct(ACL $acl, string $id)
    {
        $this->acl = $acl;
        $this->id = $id;
    }
    public function getACL() : ACL
    {
        return $this->acl;
    }
    public function getId() : string
    {
        return $this->id;
    }
}
```

Then use it in this way:

```
$acl = new Aclify\ACL();
$gigi = new User($acl, "gigi@domain.com");
if ($gigi->can("create_post"))
{
    // ...
}
```

### Usage not tight to the User object

[](#usage-not-tight-to-the-user-object)

If you don't wanna bind your user representation to the component you can avoid extending the class provided `ACLUser` and you can just use `ACL` instead, pls do as follow:

```
$acl = new Aclify\ACL();
if ($acl->can("gigi@domain.com", "create_post"))
{
    // ...
}
```

### Exceptions

[](#exceptions)

When instanciating the `ACL` class, the component tries to read the specs from a default `./acl.yml` file. If you wanna specify a different file you can pass the file path as a parameter in the contructor. If the file is not readable or not found (or not a yaml file) an exception will be thrown, so better use it in this way:

```
use Aclify\ACL;
use Aclify\Exceptions\MissingACLSpecsFile;

try {
    $acl = new ACL("./config/acl-new.yml");
    // ...
} catch (MissingACLSpecsFile $e) {
    // do something with $e
}
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% 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 ~103 days

Total

2

Last Release

2907d ago

Major Versions

0.0.1 → 1.0.02018-05-29

### Community

Maintainers

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

---

Top Contributors

[![mattmezza](https://avatars.githubusercontent.com/u/1915989?v=4)](https://github.com/mattmezza "mattmezza (2 commits)")[![fra000](https://avatars.githubusercontent.com/u/963478?v=4)](https://github.com/fra000 "fra000 (1 commits)")

---

Tags

aclkisspermission-managerphp7rolesyaml

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mattmezza-aclify/health.svg)

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

###  Alternatives

[spatie/laravel-sitemap

Create and generate sitemaps with ease

2.6k14.6M107](/packages/spatie-laravel-sitemap)[ultrono/laravel-sitemap

Sitemap generator for Laravel 11, 12 and 13

36412.6k6](/packages/ultrono-laravel-sitemap)[mischasigtermans/laravel-toon

Token-Optimized Object Notation encoder/decoder for Laravel with intelligent nested object handling

13113.1k](/packages/mischasigtermans-laravel-toon)[sbsaga/toon

🧠 TOON for Laravel — a compact, human-readable, and token-efficient data format for AI prompts &amp; LLM contexts. Perfect for ChatGPT, Gemini, Claude, Mistral, and OpenAI integrations (JSON ⇄ TOON).

6115.6k](/packages/sbsaga-toon)[prohalexey/the-choice

253.3k](/packages/prohalexey-the-choice)

PHPackages © 2026

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