PHPackages                             sunxyw/laravel-quick-role - 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. sunxyw/laravel-quick-role

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

sunxyw/laravel-quick-role
=========================

A package to quickly build a simple roles manager system

v1.0.5(5y ago)081MITPHP

Since Apr 16Pushed 5y ago1 watchersCompare

[ Source](https://github.com/sunxyw/laravel-quick-role)[ Packagist](https://packagist.org/packages/sunxyw/laravel-quick-role)[ RSS](/packages/sunxyw-laravel-quick-role/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (5)DependenciesVersions (7)Used By (0)

 Laravel Quick Role
====================

[](#-laravel-quick-role-)

 A package to quickly build a simple roles manager system.

Installing
----------

[](#installing)

```
$ composer require sunxyw/laravel-quick-role
```

Usage
-----

[](#usage)

First, add the `Sunxyw\LaravelQuickRole\HasRole` trait to your `User` model:

```
use Sunxyw\LaravelQuickRole\HasRole;

class User extends Authenticatable
{
    use HasRole;
}
```

Then, create a new role for testing:

```
use Sunxyw\LaravelQuickRole\Models\Role;

Role::create([
    'name' => 'admin',
    'title' => 'Administrator',
    'color' => 'FF5555',
]);
```

Now, you can assign a role to a user by:

```
$user = User::find(1);
$user->assignRole('admin'); // By name
$user->assignRole(Role::find(1)); // By instance
$user->assignRole(1); // By ID
```

You can check user's role by:

```
$user->hasRole('admin'); // Accept name, ID and instance
// or
$user->hasAnyRole(['admin', 'leader']);
```

License
-------

[](#license)

MIT

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity60

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

Total

6

Last Release

2084d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0074b4d8ef244d2d516e67fe7949e287b37eeee02d4adfa0da953077bf7e0121?d=identicon)[sunxyw](/maintainers/sunxyw)

---

Top Contributors

[![sunxyw](https://avatars.githubusercontent.com/u/31698606?v=4)](https://github.com/sunxyw "sunxyw (15 commits)")

### Embed Badge

![Health badge](/badges/sunxyw-laravel-quick-role/health.svg)

```
[![Health](https://phpackages.com/badges/sunxyw-laravel-quick-role/health.svg)](https://phpackages.com/packages/sunxyw-laravel-quick-role)
```

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