PHPackages                             carving-i-t/laravel-user-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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. carving-i-t/laravel-user-roles

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

carving-i-t/laravel-user-roles
==============================

Composer package for user roles in a Laravel project

v1.0.0(1y ago)018MITPHP

Since May 7Pushed 1y ago2 watchersCompare

[ Source](https://github.com/CarvingIT/laravel-user-roles)[ Packagist](https://packagist.org/packages/carving-i-t/laravel-user-roles)[ RSS](/packages/carving-i-t-laravel-user-roles/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

laravel-user-roles
==================

[](#laravel-user-roles)

Composer package for user roles in a Laravel project.

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

[](#installation)

```
composer require carving-i-t/laravel-user-roles

php artisan vendor:publish --provider="CarvingIT\LaravelUserRoles\LaravelUserRolesServiceProvider"

php artisan migrate

```

Running the role seeder (optional)
----------------------------------

[](#running-the-role-seeder-optional)

```
php artisan db:seed --class=RoleSeeder

```

Usage
-----

[](#usage)

In your User model, use the trait - LaravelUserRoles and then your user model can have following methods.

```
use CarvingIT\LaravelUserRoles\App\Traits\LaravelUserRoles;

class User extends Authenticatable{
    use LaravelUserRoles;

    .
    .
}

```

In your code elsewhere in your app -

```
//assign roles
$user->assignRoles(['admin','staff']);
//unassign roles
$user->unassignRoles(['admin']);

// check if your has a role
// returns true or false
$user->hasRole('admin');

// get all roles of a user

$roles = $user->roles(); // remember to use the parentheses

```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance49

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community8

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

Unknown

Total

1

Last Release

371d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/09038deeabb08171381048623ae6f74a950f72cf088b6b0edd887c38b50de106?d=identicon)[ketan404](/maintainers/ketan404)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/carving-i-t-laravel-user-roles/health.svg)

```
[![Health](https://phpackages.com/badges/carving-i-t-laravel-user-roles/health.svg)](https://phpackages.com/packages/carving-i-t-laravel-user-roles)
```

###  Alternatives

[lab404/laravel-impersonate

Laravel Impersonate is a plugin that allows to you to authenticate as your users.

2.3k16.4M48](/packages/lab404-laravel-impersonate)[santigarcor/laratrust

This package provides a flexible way to add Role-based Permissions to Laravel

2.3k5.4M43](/packages/santigarcor-laratrust)[overtrue/laravel-follow

User follow unfollow system for Laravel.

1.2k404.7k5](/packages/overtrue-laravel-follow)[codegreencreative/laravel-samlidp

Make your PHP Laravel application an Identification Provider using SAML 2.0. This package allows you to implement your own Identification Provider (idP) using the SAML 2.0 standard to be used with supporting SAML 2.0 Service Providers (SP).

263763.5k1](/packages/codegreencreative-laravel-samlidp)

PHPackages © 2026

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