PHPackages                             untitledpng/laravel-policy-roles - 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. untitledpng/laravel-policy-roles

ActiveLibrary

untitledpng/laravel-policy-roles
================================

Add multiple roles to a user and handle their policies

v2.1.0(3y ago)096PHPPHP &gt;=7.4

Since Jul 31Pushed 3y ago1 watchersCompare

[ Source](https://github.com/untitledpng/laravel-policy-roles)[ Packagist](https://packagist.org/packages/untitledpng/laravel-policy-roles)[ RSS](/packages/untitledpng-laravel-policy-roles/feed)WikiDiscussions master Synced yesterday

READMEChangelog (8)Dependencies (1)Versions (11)Used By (0)

laravel-policy-roles
====================

[](#laravel-policy-roles)

With this package you can have role based permissions. When the role does not exist, this package will automatically prevent access. This package also supports Laravel Nova out of the box.

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

[](#installation)

Install the package using composer `composer require untitledpng/laravel-policy-roles`.

How to use this package
-----------------------

[](#how-to-use-this-package)

- First you have to extend your user eloquent model with `Untitledpng\LaravelPolicyRoles\Domain\User`.
- Create a new policy like the example policy below.
- Now add the policy to the `AuthServiceProvider` like you normally would.
- Add Roles and Permissions to your database.
- Done!

Example policy
--------------

[](#example-policy)

```
use Untitledpng\LaravelPolicyRoles\Services\PolicyService;

class UserPolicy extends Untitledpng\LaravelPolicyRoles\Policies\BasePolicy
{
    /**
     * UserPolicy constructor.
     *
     * @param PolicyService $policyService
     */
    public function __construct(
        \Untitledpng\LaravelPolicyRoles\Services\PolicyService $policyService
    ) {
        parent::__construct('user', $policyService);
    }
}
```

Extra features
--------------

[](#extra-features)

- It is possible to use `$user->hasRole('view-user');` This will return true/ false based on if the user has that role.
- Usage of a special helper `@can('create', App\User::class) YES @endcan` to check if the user has a specific permission.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

Established project with proven stability

 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 ~88 days

Recently: every ~173 days

Total

10

Last Release

1316d ago

Major Versions

v0.0.2 → v1.0.02020-07-31

v1.x-dev → v2.0.02022-09-14

PHP version history (3 changes)v0.0.1PHP 7.3.\*|7.4.\*

v1.0.4PHP &gt;=7.3

v2.0.0PHP &gt;=7.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/44807372?v=4)[Mike Brouwer](/maintainers/untitledpng)[@untitledpng](https://github.com/untitledpng)

---

Top Contributors

[![untitledpng](https://avatars.githubusercontent.com/u/44807372?v=4)](https://github.com/untitledpng "untitledpng (14 commits)")

### Embed Badge

![Health badge](/badges/untitledpng-laravel-policy-roles/health.svg)

```
[![Health](https://phpackages.com/badges/untitledpng-laravel-policy-roles/health.svg)](https://phpackages.com/packages/untitledpng-laravel-policy-roles)
```

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[namu/wirechat

A Laravel Livewire messaging app for teams with private chats and group conversations.

54324.5k](/packages/namu-wirechat)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135192.6k5](/packages/statamic-rad-pack-runway)

PHPackages © 2026

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