PHPackages                             leafwrap/role-sanctions - 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. leafwrap/role-sanctions

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

leafwrap/role-sanctions
=======================

Role sanction is a succinct and flexible way to add Role-based Permissions to Laravel

0.0.3(2y ago)2567MITPHP

Since Mar 20Pushed 2y ago1 watchersCompare

[ Source](https://github.com/ashrafemon/role-sanctions)[ Packagist](https://packagist.org/packages/leafwrap/role-sanctions)[ RSS](/packages/leafwrap-role-sanctions/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (4)Used By (0)

Leafwrap Role Sanctions
=======================

[](#leafwrap-role-sanctions)

Role sanction is a succinct and flexible way to add Role-based Permissions to Laravel

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

[](#installation)

Use the package manager composer to install leafwrap/role-sanctions.

```
composer require leafwrap/role-sanctions
```

You can publish the config file with:

```
php artisan vendor:publish --tag=role-sanctions
```

Usage
-----

[](#usage)

### Step 1

[](#step-1)

Add all your modules in config/role-sanctions.php

```
'modules' => [
    ...modules
],
```

### Step 2

[](#step-2)

After adding all modules demonstrate all gates in AuthServiceProviders

```
if(auth()->check() && auth()->user()->role){
    RoleSanction::demonstrate(auth()->user()->role);
}
```

### Step 3

[](#step-3)

Then certify your role ability in your controller methods

```
use Leafwrap\RoleSanctions\Facades\RoleSanction;

public function index()
{
    try {
        # if use api
        $certify = RoleSanction::certify('{module}-{action}');
        # e.g. $certify = RoleSanction::certify('user-read');

        if(!$certify){
            return response()->json(['message' => 'Unauthorized'], 403);
        }

        # if use general purpose
        RoleSanction::certify('{module}-{action}');
        # e.g. $certify = RoleSanction::certify('user-read');

        ... your code
    } catch (Exception $e) {
        return $e;
    }
}
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity37

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.

###  Release Activity

Cadence

Every ~114 days

Total

3

Last Release

925d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/046373c26c047b6ba63d32c2c9f04264b38470f23a89e72171c62243a3cf059d?d=identicon)[ashrafemon](/maintainers/ashrafemon)

---

Top Contributors

[![ashrafemon](https://avatars.githubusercontent.com/u/43260899?v=4)](https://github.com/ashrafemon "ashrafemon (10 commits)")

### Embed Badge

![Health badge](/badges/leafwrap-role-sanctions/health.svg)

```
[![Health](https://phpackages.com/badges/leafwrap-role-sanctions/health.svg)](https://phpackages.com/packages/leafwrap-role-sanctions)
```

###  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)
