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.1.0(6d ago)022MITPHP

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 today

READMEChangelog (2)Dependencies (3)Versions (3)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

33

—

LowBetter than 72% of packages

Maintenance69

Regular maintenance activity

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity39

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

Total

2

Last Release

6d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5752897?v=4)[Ketan Kulkarni](/maintainers/ketan404)[@ketan404](https://github.com/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

[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135224.7k7](/packages/statamic-rad-pack-runway)[jeremy379/laravel-openid-connect

OpenID Connect support to the PHP League's OAuth2 Server. Compatible with Laravel Passport.

59437.0k9](/packages/jeremy379-laravel-openid-connect)[duncanmcclean/statamic-cargo

Comprehensive e-commerce addon for Statamic. Build bespoke e-commerce sites without the complexity.

3417.0k](/packages/duncanmcclean-statamic-cargo)

PHPackages © 2026

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