PHPackages                             doc88/flux-entity-permission - 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. doc88/flux-entity-permission

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

doc88/flux-entity-permission
============================

Library for implementing entities access control in Laravel applications.

1.1.0(5y ago)04.4k1MITPHPPHP &gt;= 7.2.0

Since Jul 6Pushed 5y ago3 watchersCompare

[ Source](https://github.com/doc88git/flux-entity-permission)[ Packagist](https://packagist.org/packages/doc88/flux-entity-permission)[ RSS](/packages/doc88-flux-entity-permission/feed)WikiDiscussions master Synced 5d ago

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

Flux Entity Permission
======================

[](#flux-entity-permission)

Library for implementing entities access control in Laravel applications.

Requirements
============

[](#requirements)

- Laravel &gt;= 6.0

Installation
============

[](#installation)

- Run the command below at the project root to add the package to the Laravel application:

```
    composer require doc88/flux-entity-permission
```

- In the *providers* list in the *config/app.php* file add:

```
    'providers' => [
        ...
        Doc88\FluxEntityPermission\FluxEntityPermissionServiceProvider::class,
    ]
```

- Run the command below at the root of your project to publish the new provider:

```
    php artisan vendor:publish
```

- Run migrations

```
    php artisan migrate
```

- In your User Model add the following lines:

```
    use Doc88\FluxEntityPermission\Traits\HasEntityPermissions;

    class User {
        use HasEntityPermissions;
    }
```

Usage
=====

[](#usage)

Doc88\\FluxEntityPermission\\EntityPermission Class
---------------------------------------------------

[](#doc88fluxentitypermissionentitypermission-class)

Class used to List, Register, Verify and Revoke permissions to entities.

- **List Entities from a User’s Permissions**

```
    // Entities which the user has access to
    EntityPermission::list($user);

    // Specifying which entity you want to list
    EntityPermission::list($user, 'App\Company');

    /**
     * Return: array
    */
```

- **List Entities IDs from a User’s Permissions**

```
    // Ids of entities which the user has access to
    EntityPermission::idList($user, 'App\Company');

    /**
     * Return: array
    */
```

- **Checks a User’s Permission to an Entity**

```
    // The entity you want to access
    $company = Company::find(1);

    // Checking if the user has access to the entity
    EntityPermission::has($user, $company);

    /**
    * Return: true or false
    */

```

- **Records permission to an Entity**

```
    // The entity you want to access
    $company = Company::find(1);

    // Grants permission to the entity for the User
    EntityPermission::register($user, $company);

    /**
    * Return: true or false
    */
```

- **Revokes permission to a Entity**

```
    // The entity you want to access
    $company = Company::find(1);

    // Revokes permission to the Entity
    EntityPermission::revoke($user, $company);

    /**
    * Return: true or false
    */

```

Using the User Model
--------------------

[](#using-the-user-model)

It is possible to List, Register, Verify and Revoke permissions to entities using the User class.

- **List User Permissions**

```
    $user = User::find(1);

    // Entities which the user has access to
    $user->listEntityAccess();

    // Specifying which entity you want to list
    $user->listEntityAccess('App\Company');

    /**
     * Return: array
    */
```

- **Checks User Permission to an Entity**

```
    $user = User::find(1);

    // The entity you want to access
    $company = Company::find(1);

    // Checking if the user has access to the entity
    $user->hasEntityAccess($company);

    /**
    * Return: true or false
    */

```

- **Records permission to an Entity**

```
    $user = User::find(1);

    // The entity you want to access
    $company = Company::find(1);

    // Grants permission to the entity for the User
    $user->registerEntityAccess($company);

    /**
    * Return: true or false
    */
```

- **Revokes permission to an Entity**

```
    $user = User::find(1);

    // The entity you want to access
    $company = Company::find(1);

    // Revokes permission to the entity
    $user->revokeEntityAccess($company);

    /**
    * Return: true or false
    */

```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity52

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

Every ~0 days

Total

3

Last Release

2139d ago

PHP version history (2 changes)1.0.0PHP &gt;=7.2.0

1.1.0PHP &gt;= 7.2.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/0a267e73f18e12044346da1ead7ff5b8c393b260499471a1d5b155a43884f99b?d=identicon)[doc88](/maintainers/doc88)

---

Top Contributors

[![douglas-men](https://avatars.githubusercontent.com/u/65043552?v=4)](https://github.com/douglas-men "douglas-men (17 commits)")

### Embed Badge

![Health badge](/badges/doc88-flux-entity-permission/health.svg)

```
[![Health](https://phpackages.com/badges/doc88-flux-entity-permission/health.svg)](https://phpackages.com/packages/doc88-flux-entity-permission)
```

###  Alternatives

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[league/oauth2-google

Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client

41721.2M118](/packages/league-oauth2-google)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)

PHPackages © 2026

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