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

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

weirdo/dynamic-acl
==================

v1.0.9(1y ago)0811PHPPHP ^8.0

Since May 1Pushed 1y ago1 watchersCompare

[ Source](https://github.com/aghabrego/dynamic-acl)[ Packagist](https://packagist.org/packages/weirdo/dynamic-acl)[ RSS](/packages/weirdo-dynamic-acl/feed)WikiDiscussions master Synced yesterday

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

Dynamic ACL
===========

[](#dynamic-acl)

Dynamic ACL is a package that handles Access Control Level on your Laravel Application. It's fast to run and simple to use. [Install](#installation) and enjoy ;)

Features
--------

[](#features)

- [Check Permissions](#check_routes): Check routes dynamically on admin permissions.
- [Simple Policy](#simple_policy): Check user\_id on your entities (if the admin has access to this).

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

[](#installation)

### Prerequisite:

[](#prerequisite)

- Make your authentication (session-based) system.
- Define a name for your routes.

```
composer require weirdo/dynamic-acl
```

### Publish config file

[](#publish-config-file)

```
php artisan vendor:publish
```

### Migrate roles table

[](#migrate-roles-table)

```
php artisan migrate
```

> Don't worry about relationships; We handle them for you.

### Run `make:admin` command

[](#run-makeadmin-command)

This command makes your first admin a super admin with a full-access level.

```
php artisan make:admin --role
```

Usage
-----

[](#usage)

Just run your application and visit `locahost:8000/admin/roles`. You'll see a list of your roles. You can create a new one, edit or delete them.

### Configuration

[](#configuration)

After publishing the vendor, you can change the configuration in the `config/dynamicACL.php` file.

It has the following options:

- **alignment:** Changes UI alignment. It can be eigther RTL or LTR. Also, when you change your lang, CRUD roles will change in (fa, en).
- **controllers\_path:** Namespace of your controllers.
- **ignore\_list:** List of routes to be ignored on permission check.

### How to use the ACL?

[](#how-to-use-the-acl)

Just add **dynamicAcl** middleware to your routes.

> now you'll see list of the routes with **dynamicAcl** middleware on `localhost:8000/admin/roles/create`.
>
> also, this middleware will check your admin access to the current route.

### Access to the roles

[](#access-to-the-roles)

You can write your queries with the Role model to get the list of roles and use it on your admin/user CRUD views.

```
use Weirdo\DynamicAcl\Models\Role;
```

### Sync user roles

[](#sync-user-roles)

You can use `sync`, `attach`, and `detach` methods to assign user roles.

```
$user->roles()->sync([1, 2, 3,...]);
```

### Get user roles

[](#get-user-roles)

```
$user->roles()->get();
```

### Check user access manually

[](#check-user-access-manually)

Call the `hasPermission` method on the user and pass the route name:

```
auth()->user()->hasPermission('admin.articles.create');
```

Check whether the user has access to any routes of an entity:

```
auth()->user()->hasPermission('admin.articles.*')
```

Also, you can check if the user has access to his entity:

```
$user->hasPermission('admin.articles.update', $article);

// Or with a custom relation_key (default is 'user_id')
$user->hasPermission('admin.articles.update', $article, 'owner_id');
```

### Check Ownership

[](#check-ownership)

Check manually whether the user is the owner of an entity:

```
$user->isOwner($article);

// Or with a custom relation_key
$user->isOwner($article, 'owner_id');

// Or pass it as ['model' => id]
$user->isOwner(['article' => $article->id]);

// Or with a custom model path
$user->isOwner(['App\\Article' => $article->id]);
```

### Dynamic Policy

[](#dynamic-policy)

Using dynamic policy is straightforward too. Just add **authorize** middleware to your routes. You can pass the foreign key as a parameter (default is user\_id). This middleware checks the foreign key of your entity.

> **NOTE:** It is necessary to use route model binding on your controllers.

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 94.9% 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 ~134 days

Total

5

Last Release

623d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/18662762?v=4)[Angel Hidalgo](/maintainers/aghabrego)[@aghabrego](https://github.com/aghabrego)

---

Top Contributors

[![iya30n](https://avatars.githubusercontent.com/u/44727579?v=4)](https://github.com/iya30n "iya30n (167 commits)")[![aghabrego](https://avatars.githubusercontent.com/u/18662762?v=4)](https://github.com/aghabrego "aghabrego (5 commits)")[![alibagherifam](https://avatars.githubusercontent.com/u/45685603?v=4)](https://github.com/alibagherifam "alibagherifam (3 commits)")[![reziamini](https://avatars.githubusercontent.com/u/29504334?v=4)](https://github.com/reziamini "reziamini (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/weirdo-dynamic-acl/health.svg)

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

###  Alternatives

[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135224.7k7](/packages/statamic-rad-pack-runway)[jeremy379/laravel-openid-connect

OpenID Connect support to the PHP League's OAuth2 Server. Compatible with Laravel Passport.

59437.0k9](/packages/jeremy379-laravel-openid-connect)[ecotone/laravel

Ecotone for Laravel — CQRS, Event Sourcing, Sagas, Durable Workflows, and Outbox on top of Laravel Queue, via PHP attributes.

21318.6k3](/packages/ecotone-laravel)

PHPackages © 2026

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