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

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

am2studio/laravel-acl
=====================

acl

1.0.0(10y ago)01.6kMITPHPPHP &gt;=5.4.0

Since Jan 26Pushed 10y ago3 watchersCompare

[ Source](https://github.com/AM2studio/Laravel-ACL)[ Packagist](https://packagist.org/packages/am2studio/laravel-acl)[ Docs](https://github.com/AM2Studio/Laravel-ACL)[ RSS](/packages/am2studio-laravel-acl/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (2)Used By (0)

laravel-acl
===========

[](#laravel-acl)

[![Latest Version on Packagist](https://camo.githubusercontent.com/178f7aaa076089117b89246085a2fe949adadeb795e1e9d607dcf60cd2757edc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616d3273747564696f2f6c61726176656c2d61636c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/am2studio/laravel-acl)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/e76573110870537815ea2bfde32327397e7721115875bdbdeeceb46ca2085d8e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616d3273747564696f2f6c61726176656c2d61636c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/am2studio/laravel-acl)

Install
=======

[](#install)

Via Composer

```
$ composer require am2studio/laravel-acl
```

Service Provider
----------------

[](#service-provider)

in `config/app.php`

under `'providers'` add

```
AM2Studio\LaravelAcl\LaravelAclServiceProvider::class
```

Config and Migration
--------------------

[](#config-and-migration)

```
php artisan vendor:publish --provider="AM2Studio\LaravelACL\LaravelACLServiceProvider" --tag=config
php artisan vendor:publish --provider="AM2Studio\LaravelACL\LaravelACLServiceProvider" --tag=migrations
```

Trait
-----

[](#trait)

In user model add following

```
...
use AM2Studio\LaravelAcl\Traits\LaravelACLTrait;

class User extends Model {
    use LaravelACLTrait, ... ;
}
```

Usage
=====

[](#usage)

Creating roles
--------------

[](#creating-roles)

```
use AM2Studio\LaravelACL\Models\Role;

$userRole = Role::create([
    'name' => 'User',
    'slug' => 'user',
    'description => '',
]);
```

Attaching and detaching roles
-----------------------------

[](#attaching-and-detaching-roles)

```
$user = User::find(1);
$user->attachRole($userRole);
$user->detachRole($userRole);
$user->detachAllRoles();
```

Checking for role
-----------------

[](#checking-for-role)

```
$user->is('user'); // Checkes if user has user role
$user->is('admin|user'); // Checks if user has user OR admin role
$user->is('admin|user', true); // Checks if user has user AND admin role
```

Creating permissions
--------------------

[](#creating-permissions)

```
use AM2Studio\LaravelACL\Models\Permssion;

$p = Role::create([
    'name' => 'Event edit',
    'slug' => 'event.edit',
    'description => '',
]);
```

Attaching and detaching permissions
-----------------------------------

[](#attaching-and-detaching-permissions)

```
$user = User::find(1);
$user->attachPermission($p);
$user->detachPermission($p);
$user->detachAllPermissions();

$role = Role::find(1);
$role->attachPermission($p);
$role->detachPermission($p);
$role->detachAllPermissions();
```

Checking for role
-----------------

[](#checking-for-role-1)

```
$user->can('event.edit'); // Checkes if user has permission
$user->can('event.edit|event.create'); // Checks if user has event.edit OR event.create permission
$user->can('event.edit|event.create', true); // Checks if user has event.edit AND event.create permission
```

Model permissions
-----------------

[](#model-permissions)

```
$p2 = Role::create([
    'name' => 'Event edit',
    'slug' => 'event.edit',
    'description => '',
    'model' => 'event',
]);
$p3 = Role::create([
    'name' => 'Event edit',
    'slug' => 'event.edit',
    'description => '',
    'model' => 'event',
    'resource_id' => 1,
]);

$event = Event::find(1);

$user->attachPermisson($p2);
$user->attachPermisson($p3);

$user->allowed('event.edit', $event); // Checks if user has rights to Event model
$user->allowed('event.edit', $event, $event->id); // Checks if user has rights to Event model with selected id
```

Blade Extensions
----------------

[](#blade-extensions)

```
@role('admin')
@endrole

@permission('edit.event')
@endpermission

@allowed('edit.event', $event)
@endallowed

@role('admin|user', 'all')
@endrole
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.

Credits
-------

[](#credits)

- [Marko Šamec](https://github.com/msamec)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

3808d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4154034?v=4)[Marko Samec](/maintainers/msamec)[@msamec](https://github.com/msamec)

---

Top Contributors

[![msamec](https://avatars.githubusercontent.com/u/4154034?v=4)](https://github.com/msamec "msamec (2 commits)")

---

Tags

aclAM2Studio

### Embed Badge

![Health badge](/badges/am2studio-laravel-acl/health.svg)

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

###  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.6M47](/packages/santigarcor-laratrust)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k3.5M118](/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)

3779.6M307](/packages/nette-security)

PHPackages © 2026

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