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

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

paliari/php-acl
===============

Simple ACL control for PHP

0.0.5(6y ago)271MITPHP

Since May 23Pushed 6y ago4 watchersCompare

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

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

php-acl
=======

[](#php-acl)

Simple ACL control for PHP

Install
=======

[](#install)

```
composer require paliari/php-acl
```

Usage
=====

[](#usage)

You can set permissions for a namespace, controller, and even a specific method

```
$user_permissions = [
    'customers' => [
        'products' => [
            'index' => true,
            'show' => true
        ],
        'services' => true
    ],
    'admin' => true
];
$acl = new Paliari\PhpAcl\Acl($user_permissions);

// With permission
$callable = 'Customers\\Products:index';
$response = $acl->allowed(Paliari\PhpAcl\AclOperator::keys($callable));
var_export($response); // true

// Without permission
$callable = 'Customers\\Products:destroy';
$response = $acl->allowed(Paliari\PhpAcl\AclOperator::keys($callable));
var_export($response); // false
```

Using as a middleware in Slim Framework
---------------------------------------

[](#using-as-a-middleware-in-slim-framework)

```
