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

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

samshal/acl
===========

This package provides a lightweight and flexible access control list for privileges and permission management.

v1.0(10y ago)119859[1 issues](https://github.com/Samshal/Acl/issues)MITPHPPHP ^7.0CI failing

Since Jun 8Pushed 1y ago2 watchersCompare

[ Source](https://github.com/Samshal/Acl)[ Packagist](https://packagist.org/packages/samshal/acl)[ RSS](/packages/samshal-acl/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)DependenciesVersions (3)Used By (0)

Acl [![Build Status](https://camo.githubusercontent.com/4ea4efc163648698f12a0dabb0dda135fe6057f00b4179acb2ca96300f3981ad/68747470733a2f2f7472617669732d63692e6f72672f53616d7368616c2f41636c2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Samshal/Acl) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/8c8b66aaa4fca9aa392d4c9723ddacd3f1b5296a9203d77cec1594d96c4df305/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f53616d7368616c2f41636c2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Samshal/Acl/?branch=master)
=====================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#acl--)

Samshal\\Acl adds a role based permission system for user authentication. In general, it provides a lightweight access control list for privileges and permission management.

### Why you might need it

[](#why-you-might-need-it)

Access Control Lists allow an application to control access to its areas, they provide a flexible interface for creating Permissions, Roles, Resources and assigning the created permissions on roles.

This component is an implementation of an ACL, it makes it easy for you to get up and running with user authorization.

### Class Features

[](#class-features)

- Creation of Resources, Roles and Permissions
- Ability to set Permissions on Resources and granting these Permissions to Roles.
- Support for Role Inheritance.
- Fully Serializable, can work interoperably with any source of data.
- Compatible with PHP v8.1+
- Easy to use

**Resources** are objects which acts in accordance to the permissions defined on them by the ACLs. **Roles** are objects that requests access to resources and can be allowed or denied by the ACL layers. **Permissions** are just rules defined on Resources.

### Metrics of master branch

[](#metrics-of-master-branch)

[![Package Metrics](https://raw.githubusercontent.com/Samshal/Acl/master/phpmetric_maintainability.png)](https://raw.githubusercontent.com/Samshal/Acl/master/phpmetric_maintainability.png)

### License

[](#license)

This software is distributed under the [MIT](https://opensource.org/licenses/MIT) license. Please read LICENSE for information on the software availability and distribution.

### Installation

[](#installation)

Samshal\\Acl is available via [Composer/Packagist](https://packagist.org/packages/samshal/acl), so just add this line to your `composer.json` file:

```
	{
		"require":{
			"samshal/acl":"^2.0"
		}
	}
```

or

```
	composer require samshal/acl
```

### Getting Started

[](#getting-started)

#### Creating an ACL

[](#creating-an-acl)

Creating an ACL component is as easy as instantiating `Samshal\Acl`. The constructor **currently** accepts no arguments. An example of instantiation is:

```
