PHPackages                             distilleries/permission-util - 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. distilleries/permission-util

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

distilleries/permission-util
============================

Provide a system to detect if the user connected have access or not. Provide a middleware to restrict access with a 403

v1.11.0(6y ago)28.6k41MITPHPPHP &gt;=7.1.3

Since Feb 20Pushed 6y ago4 watchersCompare

[ Source](https://github.com/Distilleries/PermissionUtil)[ Packagist](https://packagist.org/packages/distilleries/permission-util)[ RSS](/packages/distilleries-permission-util/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (10)Dependencies (8)Versions (18)Used By (1)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/b42893d9f0053383f62e11ad16545050281d4fe7473b832a614c3d9228429dfd/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f44697374696c6c65726965732f5065726d697373696f6e5574696c2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Distilleries/PermissionUtil/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/f26013b2a8a13fb0c32515e25896f9e15eed38368a5f67e2ae6a9dd0d4f70d07/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f44697374696c6c65726965732f5065726d697373696f6e5574696c2f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Distilleries/PermissionUtil/?branch=master)[![Build Status](https://camo.githubusercontent.com/3e9b7977e3179e4947ac03959dffcd3b80fd01f9d23dbddf2173496b694c1ab8/68747470733a2f2f7472617669732d63692e6f72672f44697374696c6c65726965732f5065726d697373696f6e5574696c2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Distilleries/PermissionUtil)[![Total Downloads](https://camo.githubusercontent.com/df591e6f3a9755c9e4c0124c31d66fb1205f76e65a2df4f47f0d48e16ed49373/68747470733a2f2f706f7365722e707567782e6f72672f64697374696c6c65726965732f7065726d697373696f6e2d7574696c2f646f776e6c6f616473)](https://packagist.org/packages/distilleries/permission-util)[![Latest Stable Version](https://camo.githubusercontent.com/0d0c27c30fe6a743d94da9b5bef36e6450fecb073f429479a97e9d30973a46b7/68747470733a2f2f706f7365722e707567782e6f72672f64697374696c6c65726965732f7065726d697373696f6e2d7574696c2f76657273696f6e)](https://packagist.org/packages/distilleries/permission-util)[![License](https://camo.githubusercontent.com/f251623e510f5909f16ae3f4e6e548dac11340b9fde1a99be26b015b39272c00/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c6174)](LICENSE)

Laravel 5 Permission Util
=========================

[](#laravel-5-permission-util)

Provide a system to detect if the user connected have access or not. Provide a middleware to restrict access with a 403

Table of contents
-----------------

[](#table-of-contents)

1. [Installation](#installation)
2. [Basic usage](#basic-usage)
3. [Middleware](#middleware)

\##Installation

Add on your composer.json

```
    "require": {
        "distilleries/permission-util": "1.*",
    }
```

run `composer update`.

Add Service provider to `config/app.php`:

```
    'providers' => [
        // ...
       'Distilleries\PermissionUtil\PermissionUtilServiceProvider',
    ]
```

And Facade (also in `config/app.php`)

```
    'aliases' => [
        // ...
        'PermissionUtil'   => 'Distilleries\PermissionUtil\Facades\PermissionUtil',
    ]
```

Export the configuration:

```
php artisan vendor:publish --provider="Distilleries\PermissionUtil\PermissionUtilProvider"

```

\###Basic usage To check the permission, I use the `auth` of your application. On your model use for the Auth implement the interface `Distilleries\PermissionUtil\Contracts\PermissionUtilContract` add the method `hasAccess` to define if the user have access or not. The key in param is a string action like `UserController@getEdit`.

```
    public function hasAccess($key)
    {
        return true;
    }
```

If the user is connected and your model haven't this method the class return true. If the user is not connected the permission util return false. To disabled the restriction of connected user just go in config file and put false in `auth_restricted`.

You can use the facade to detect if the user can access or not:

MethodCallDescription`hasAccess``PermissionUtil::hasAccess('Controller@action')`Return if the user can access to this action\##Middleware The package provide a middleware to detect automatically if the user can access to a method of a controller. To active it just add on your `app/Http/Kernel`:

```
    protected $routeMiddleware = [
        //...
		'permission' => 'Distilleries\PermissionUtil\Http\Middleware\CheckAccessPermission',
	];
```

And on your controller or your route add the middleware:

```
    public function __construct()
    {
        $this->middleware('permission');

    }
```

If the user can access to an action that dispatch a 403

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 55.2% 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 ~110 days

Recently: every ~143 days

Total

16

Last Release

2533d ago

PHP version history (5 changes)1.0.0PHP &gt;=5.5.0

1.1.2PHP &gt;=5.4.0

1.5.0PHP &gt;=5.6.4

1.7.0PHP &gt;=7

1.8.0PHP &gt;=7.1.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/c1edc17683ed39a2cc6dbe453c2c5aaa63468fc5b54f13941f260ebe260da211?d=identicon)[Kezho](/maintainers/Kezho)

---

Top Contributors

[![mfrancois](https://avatars.githubusercontent.com/u/654224?v=4)](https://github.com/mfrancois "mfrancois (37 commits)")[![jeefave](https://avatars.githubusercontent.com/u/5779391?v=4)](https://github.com/jeefave "jeefave (11 commits)")[![mfrancoisbbs](https://avatars.githubusercontent.com/u/133215273?v=4)](https://github.com/mfrancoisbbs "mfrancoisbbs (8 commits)")[![bbs-smuller](https://avatars.githubusercontent.com/u/18079210?v=4)](https://github.com/bbs-smuller "bbs-smuller (4 commits)")[![mikaelpopowicz](https://avatars.githubusercontent.com/u/5689944?v=4)](https://github.com/mikaelpopowicz "mikaelpopowicz (3 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (3 commits)")[![intraordinaire](https://avatars.githubusercontent.com/u/1721887?v=4)](https://github.com/intraordinaire "intraordinaire (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/distilleries-permission-util/health.svg)

```
[![Health](https://phpackages.com/badges/distilleries-permission-util/health.svg)](https://phpackages.com/packages/distilleries-permission-util)
```

###  Alternatives

[illuminate/routing

The Illuminate Routing package.

1239.4M3.5k](/packages/illuminate-routing)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-laravel)[illuminate/auth

The Illuminate Auth package.

9328.5M1.4k](/packages/illuminate-auth)[api-platform/laravel

API Platform support for Laravel

58190.1k21](/packages/api-platform-laravel)[alajusticia/laravel-logins

Session management in Laravel apps, user notifications on new access, support for multiple separate remember tokens, IP geolocation, User-Agent parser

2115.6k](/packages/alajusticia-laravel-logins)[masterix21/laravel-licensing

Laravel licensing package with polymorphic assignment to any model, activation keys, expirations/renewals, and seat control via LicenseUsage. Supports offline verification with public-key–signed tokens, a CLI to generate/rotate/revoke keys, and an extensible architecture via config and contracts.

1614.1k4](/packages/masterix21-laravel-licensing)

PHPackages © 2026

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