PHPackages                             sammaye/laravel-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. sammaye/laravel-permission

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

sammaye/laravel-permission
==========================

A quick Laravel permissions plugin

026PHP

Since Sep 17Pushed 6y ago1 watchersCompare

[ Source](https://github.com/Sammaye/laravel-permission)[ Packagist](https://packagist.org/packages/sammaye/laravel-permission)[ RSS](/packages/sammaye-laravel-permission/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

laravel-permission
==================

[](#laravel-permission)

Really simple permissions (RBAC) plugin for Laravel.

Usage
-----

[](#usage)

### Configure

[](#configure)

You can find the configuration in `config/sammaye.permission.php` and it is called like `config('sammaye.permission.permissions')` to get a list of configured default permissions.

#### Adding Permissions/Roles

[](#adding-permissionsroles)

Add content to the `permissions` key, arrays will be translated into roles and the elements into permissions.

#### Changing User

[](#changing-user)

If you're not using the default `User` model then you change the `user` key.

### Add `User` Trait

[](#add-user-trait)

Add `sammaye\Permission\Traits\HasPermission` to your user model.

### Finish

[](#finish)

You're done.

Commands
--------

[](#commands)

### Refersh permissions and roles

[](#refersh-permissions-and-roles)

#### `permission:refresh`

[](#permissionrefresh)

Will sync the permissions in your database with those in your configuration, so if you add new role and/or permissions in your configuration they will be reflected in your database.

#### `permission:permission {name} {user_id?}`

[](#permissionpermission-name-user_id)

Will create a permission, if not existing, and assign it to a user, if supplied.

#### `permission:role {name} {user_id?}`

[](#permissionrole-name-user_id)

Will create a role, if not existing, and assign it to a user, if supplied.

#### `permission:role-permission {role_id} {permission_id}`

[](#permissionrole-permission-role_id-permission_id)

Will assign a role to a permission, will not create either if they do not exist.

Overriding what's in the database
---------------------------------

[](#overriding-whats-in-the-database)

You can easily replace rules from the database with your own gate, like so:

```
Gate::define('update-post', function(User $user, Post $post){
    return $user->hasPermission('edit-post') && $user->id === $post->user_id;
});
```

Needs Improvement
-----------------

[](#needs-improvement)

- Caching of permissions to stop database calls which involve `JOIN`s

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/7357836d822160350576f98b85244f4d5f960be303a2fcaa15a330187966cbd4?d=identicon)[Sammaye](/maintainers/Sammaye)

---

Top Contributors

[![Sammaye](https://avatars.githubusercontent.com/u/323996?v=4)](https://github.com/Sammaye "Sammaye (21 commits)")

### Embed Badge

![Health badge](/badges/sammaye-laravel-permission/health.svg)

```
[![Health](https://phpackages.com/badges/sammaye-laravel-permission/health.svg)](https://phpackages.com/packages/sammaye-laravel-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)
