PHPackages                             bearsunday/acl-resource - 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. bearsunday/acl-resource

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

bearsunday/acl-resource
=======================

1.x-dev(8y ago)21931MITPHPPHP &gt;=7.0.0

Since Jan 22Pushed 8y ago3 watchersCompare

[ Source](https://github.com/bearsunday/BEAR.AclResource)[ Packagist](https://packagist.org/packages/bearsunday/acl-resource)[ RSS](/packages/bearsunday-acl-resource/feed)WikiDiscussions 1.x Synced 3w ago

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

BEAR.AclResource
================

[](#bearaclresource)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/a8ec46b157612d2ae2e2f7ea30f849a2cb38e381ce5578a3151630e307d22f20/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6265617273756e6461792f424541522e41636c5265736f757263654d6f64756c652f6261646765732f7175616c6974792d73636f72652e706e673f623d312e78)](https://scrutinizer-ci.com/g/bearsunday/BEAR.AclResourceModule/?branch=1.x)[![Code Coverage](https://camo.githubusercontent.com/c36adbd0aeab5df5ca66a5f0eb3a215c6eec51adff3d9865620b2a6c1dbc22a6/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6265617273756e6461792f424541522e41636c5265736f757263654d6f64756c652f6261646765732f636f7665726167652e706e673f623d312e78)](https://scrutinizer-ci.com/g/bearsunday/BEAR.AclResourceModule/?branch=1.x)[![Build Status](https://camo.githubusercontent.com/0b4335aa323a4e0ad097dfcf385294a8eba0081f4758e855374a67c63fcb91ac/68747470733a2f2f7472617669732d63692e6f72672f6265617273756e6461792f424541522e41636c5265736f757263654d6f64756c652e7376673f6272616e63683d312e78)](https://travis-ci.org/bearsunday/BEAR.AclResourceModule)

An ACL embedded resources module for BEAR.Sunday

This module embeds the app resource corresponding to the ACL in the specified page resource. Whereas the `@Embedded` annotation hard-codes and embeds app resources, this module embeds resources based on configuration. You can change the resource tree of page without changing the source code.

Install
=======

[](#install)

Composer install
----------------

[](#composer-install)

```
$ composer require bearsunday/acl-resource 1.x-dev

```

Module install
--------------

[](#module-install)

```
use Ray\Di\AbstractModule;
use Ray\TestDouble\TestDoubleModule;
use Ray\RoleModule\RoleProviderInterface;

class DevRoleProvider implements RoleProviderInterface
{
    // provide role
    public function get()
    {
        return 'guest';
    }
}

class AppModule extends AbstractModule
{
    protected function configure()
    {
        // configure ACL
        $acl = new Acl();
        $roleGuest = new Role('guest');
        $acl->addRole($roleGuest);
        $acl->addRole(new Role('owner'), $roleGuest);
        $acl->addResource(new Resource('app://self/entries'));
        $acl->addResource(new Resource('app://self/users'));
        $acl->addResource(new Resource('app://self/comments'));
        $acl->allow('guest', ['app://self/entries', 'app://self/comments']);
        $acl->allow('admin', 'app://self/friends');
        // configure embedded resource list
        $resources = [
            'page://self//blog' => [
                 'app://self/entries',
                 'app://self/comments',
                 'app://self/friends'
             ],
            'page://self//admin/setting' => [
                'app://self/user{?id}',
                'app://self/freinds?user_id={id}'
            ]
        ];
        // define provider
        $roleProviderClass = DevRoleProvider::class;
        // install module
        $this->install(new AclResourceModule($acl, $resources, $roleProviderClass));
    }
}
```

- `$acl` has an ACL (access control list) of [Zend\\Permaissions\\Acl](https://framework.zend.com/manual/2.2/en/modules/zend.permissions.acl.intro.html) Specify. `addResource` all the URI path of the `app` resources available for `$acl` and specify an app resource that is accessible / impossible to the role with the `allow()` / `disallow()` method.
- `$resources` is a list of which app resources can be embedded by each page resource.
- `$roleProviderClass` specifies the class name to return the current user's role (eg from login status). You need to implement `RoleProviderInterface`.

In the example above, when accessing the `/blog` page with `guest` authority, **request objects** of `app://self/entries` and ` app://self/comments` are set to `$body['entries']`, `$body['comments]`.

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85.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

Unknown

Total

1

Last Release

3074d ago

### Community

Maintainers

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

---

Top Contributors

[![koriym](https://avatars.githubusercontent.com/u/529021?v=4)](https://github.com/koriym "koriym (18 commits)")[![shiori-koga](https://avatars.githubusercontent.com/u/49051632?v=4)](https://github.com/shiori-koga "shiori-koga (3 commits)")

---

Tags

acl-librarybearsundaybearsunday-moduleaclBEAR

### Embed Badge

![Health badge](/badges/bearsunday-acl-resource/health.svg)

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

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k98.0M1.3k](/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.3M63](/packages/zizaco-entrust)[santigarcor/laratrust

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

2.3k5.6M46](/packages/santigarcor-laratrust)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k3.5M117](/packages/bezhansalleh-filament-shield)[casbin/casbin

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

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

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

3769.6M306](/packages/nette-security)

PHPackages © 2026

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