PHPackages                             nagy/permissions-handler - 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. nagy/permissions-handler

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

nagy/permissions-handler
========================

v3.1.1(7y ago)13834MITPHP

Since Jun 18Pushed 7y ago1 watchersCompare

[ Source](https://github.com/mohamednagy/Permissions-Handler)[ Packagist](https://packagist.org/packages/nagy/permissions-handler)[ RSS](/packages/nagy-permissions-handler/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (4)Dependencies (6)Versions (10)Used By (0)

Permissions Handler
===================

[](#permissions-handler)

Permissions-handler is an easy-to-use package for laravel 5 to manage users roles and permissions in an easy and attractive way

- [Installation](https://github.com/mohamednagy/Permissions-Handler/wiki/installation)
- [Config](https://github.com/mohamednagy/Permissions-Handler/wiki/config)
- [Usage](https://github.com/mohamednagy/Permissions-Handler/wiki/usage)
    - [With routes and methods](https://github.com/mohamednagy/Permissions-Handler/wiki/usage#with-routes)
    - [Blade directive](https://github.com/mohamednagy/Permissions-Handler/wiki/usage#blade-directives)
    - [Within your code](https://github.com/mohamednagy/Permissions-Handler/wiki/usage#within-your-code)
    - [Artisan commands](https://github.com/mohamednagy/Permissions-Handler/wiki/usage#artisan-commands)

Features
--------

[](#features)

### Caching

[](#caching)

Permissions Handler uses the caching feature on two levels

- **Database Cache**:
    Permissions Handler uses the cache driver that configured in your `cache.php` file for caching user permissions, roles for configurable time.
- **Annotation Cache**:
    Because of parsing the files against the annotations is costy; permission Hander caches the parsed annotations to avoid parsing it again. by default this features is disabled in the development environment and enabled in the production.

### [Gate](https://laravel.com/docs/5.5/authorization#gates) Integration

[](#gate-integration)

PermissionsHandler register users permissions into the `Gate`, so you can easly use laravel built in `can` method.

### Guard Support

[](#guard-support)

PermissionsHandler doesn't depend on a specific model or guard, you can use whatever models or guards you need, PermissionsHandler will handle all.

### Seeder

[](#seeder)

If you enabled the `seeder` option from the `config/permissionsHandler.php` file then Permissions Handler will save each created permission, role and role-permissions to fils to be able to seed it again in later time or share them with others.

### Annotations

[](#annotations)

PermissionsHandler comes with an optinal awesome feature **Annotations**, it is based on Doctrine\\Annotations. you can use it as the following:

```
use PermissionsHandler\Owns;
use PermissionsHandler\Roles;
use PermissionsHandler\Permissions;
.
.
.

/**
 * @Permissions({"add-posts"})
 */
function store(Request $request) {
    // your code here
}

/**
 * @Roles({"admin"})
 */
function delete(Request $request) {
    // your code here
}

/**
 * @Owns(relation="posts", parameter="id")
 */
function update(Request $request) {
    // your code here
}

```

As the above example, Permissions Handler comes with three types of annotations.

- `Permissions({"perm1"})`:
     only users that have *perm1* permission can access this method
- `Roles({"role1"})`:
     only users that have *role1* role can access this method
- `Owns(relation="posts", parameter="id")`:
     for example, if you are the owner of the post then only you whose can edit this post. `Owns` will ensure that, just pass the relation and the parameter which *PermissionsHandler* will get the value from the *Request* accordingly.

Check the [usage](https://github.com/mohamednagy/Permissions-Handler/wiki/usage) section for more features and details

License
-------

[](#license)

[MIT License](http://opensource.org/licenses/MIT)

**Thanks to [Ahmed Sorour](https://github.com/aserour) &lt;3**

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 86.7% 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 ~86 days

Recently: every ~111 days

Total

8

Last Release

2688d ago

Major Versions

1.0 → 2.02017-11-06

2.3 → v3.02017-12-06

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/10484012?v=4)[Mohamed Nagy](/maintainers/mohamednagy)[@mohamednagy](https://github.com/mohamednagy)

---

Top Contributors

[![mohamednagy](https://avatars.githubusercontent.com/u/10484012?v=4)](https://github.com/mohamednagy "mohamednagy (78 commits)")[![ahmedalaahagag](https://avatars.githubusercontent.com/u/13071117?v=4)](https://github.com/ahmedalaahagag "ahmedalaahagag (10 commits)")[![atefBB](https://avatars.githubusercontent.com/u/10966925?v=4)](https://github.com/atefBB "atefBB (1 commits)")[![thinkstylestudio](https://avatars.githubusercontent.com/u/322368?v=4)](https://github.com/thinkstylestudio "thinkstylestudio (1 commits)")

---

Tags

annotationlaravelpackagistpermissionsphp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/nagy-permissions-handler/health.svg)

```
[![Health](https://phpackages.com/badges/nagy-permissions-handler/health.svg)](https://phpackages.com/packages/nagy-permissions-handler)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.8k532.1M19.4k](/packages/laravel-framework)[api-platform/core

Build a fully-featured hypermedia or GraphQL API in minutes!

2.6k50.1M314](/packages/api-platform-core)[illuminate/support

The Illuminate Support package.

582110.9M39.8k](/packages/illuminate-support)[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k12](/packages/tempest-framework)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M196](/packages/sulu-sulu)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9317.2k55](/packages/open-dxp-opendxp)

PHPackages © 2026

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