PHPackages                             nybbl/access-acl - 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. nybbl/access-acl

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

nybbl/access-acl
================

Provides an easy zf3 acl implementation.

v1.0.2(7y ago)013BSD-3-ClausePHPPHP &gt;=7.0

Since Feb 4Pushed 7y agoCompare

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

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

Nybbl Access ACL
================

[](#nybbl-access-acl)

An easy to use ACL implementation for ZF3. Provides support for Doctrine out of the box.

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

[](#installation)

```
$ composer require nybbl/access-acl

```

Usage
-----

[](#usage)

To use this module, add it to your modules.config.php file:

```
return [
    ...

    'Nybbl\AccessAcl',
];
```

Optional Config
---------------

[](#optional-config)

If you want to further configure the module, copy the contents of this package's config/module.config.php into config/autoload/nybbl.access.acl.config.php or into your config/autoload/global.php file.

```
'access_manager' => [
    'redirect_route_name' => 'application.home',
    'default_access_all_role' => 'Guest',
],
```

Config key descriptions:

- redirect\_route\_name: The route name where the application should redirect. For example, you might want unauthorised users to be redirect to "user.login".
- default\_access\_all\_role: The default role. If there's no identity in the AuthenticationService, then the default role is "Guest".

Mapping Resources
-----------------

[](#mapping-resources)

The core of an ACL is a resource. To map your resources (aka controllers), you can specify an array key in your module configs.

Application/config/module.config.php:

```
'controllers' => [
    'factories' => [
        Controller\ApplicationController::class => InvokableFactory::class,
    ],
],

## This is where you can specify your resources
'access_manager' => [
    'resources' => [
        Controller\ApplicationController::class => [
            [
                'allow'   => 'Guest',
                'actions' => ['index'],
            ],
            [
                'allow'   => 'Admin',
                'actions' => ['home', 'users', 'posts'],
            ],
        ],
    ],
],
```

Customising the not-authorised view
-----------------------------------

[](#customising-the-not-authorised-view)

By default, the "not-authorised" view just renders some text. You most likely want to customise this. You can create a view directory in any module with the path:

```
access-acl/not-authorised/index.twig

```

Changing Role Providers
-----------------------

[](#changing-role-providers)

To change your role provider, you'll need a class that implements the RoleProviderInterface. Then add the alias to the interface in your module config:

```
'service_manager' => [
    'aliases' => [
        Nybbl\AccessAcl\Contract\RoleProviderInterface::class => MyCustomRoleProvider::class,
    ],
],
```

Creating Roles
--------------

[](#creating-roles)

To create a role, you'll need to create a class that implements the Nybbl\\AccessAcl\\Contract\\RoleInterface

Like so:

```
class AdminRole implements RoleInterface
{
    // Implement body methods.
}
```

Your custom role provider can then consume these roles.

Creating Dynamic Assertions
---------------------------

[](#creating-dynamic-assertions)

```
use Nybbl\AccessAcl\Contract\DynamicAssertionInterface;

class ExampleAssertion implements DynamicAssertionInterface
{
    /**
     * @param string $resource
     * @param null $privilege
     * @param array $options
     * @return bool|mixed
     */
    public function assert(string $resource, $privilege = null, array $options = [])
    {
        // Implement yor logic based on the result...
        if ($options['can.edit']) {
            if ($options['identity']->id() === $options['blogPost']->ownerId()) {
                return self:ACCESS_GRANTED;
            }
        }
    }
}
```

In your controller:

```
public function editAction()
{
    $this->assert(ExampleAssertion::class, 'index', 'can.edit', [
        'identity' => $this->identity(),
        'blogPost' => $blogPostEntity,
    ]);

    return new ViewModel();
}
```

By default, a dynamic assertion will return false.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity57

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

Total

3

Last Release

2656d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a16ac310fcadc23040abbf5ae71639e3b7460d6d76d6f580e63f4dae20399d46?d=identicon)[\_\_nicd](/maintainers/__nicd)

---

Top Contributors

[![nic-d](https://avatars.githubusercontent.com/u/136451184?v=4)](https://github.com/nic-d "nic-d (8 commits)")

---

Tags

aclzendzend-frameworkzf3aclZendFrameworkzfzf3

### Embed Badge

![Health badge](/badges/nybbl-access-acl/health.svg)

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

###  Alternatives

[saeven/zf3-circlical-user

Complete user entity, rights, and access module for Laminas

3718.7k](/packages/saeven-zf3-circlical-user)[saeven/zf3-circlical-autowire

Annotation based routing, and magic Controller creation for Laminas and ZF3.

1430.0k](/packages/saeven-zf3-circlical-autowire)

PHPackages © 2026

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