PHPackages                             kilroyweb/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. kilroyweb/roles

ActiveLibrary

kilroyweb/roles
===============

Support for user roles

1.0.1(8y ago)0701MITPHP

Since Jun 28Pushed 8y ago1 watchersCompare

[ Source](https://github.com/kilroyweb/roles)[ Packagist](https://packagist.org/packages/kilroyweb/roles)[ RSS](/packages/kilroyweb-roles/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

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

[](#installation)

```
composer require kilroyweb/roles

```

Add to the $routeMiddleware array in app/Http/Kernel.php

```
'role' => \KilroyWeb\Roles\Middleware\AuthHasRole::class,
```

Add the HasRole trait to your User class

```
use \KilroyWeb\Roles\Traits\HasRole;
```

Routes
------

[](#routes)

Use the supplied "role" middleware to pass allowed roles

```
Route::prefix('/manage')->middleware(['auth','role:admin,employee'])->group(function(){
    ...
});
```

Available Methods
-----------------

[](#available-methods)

Use the roleIs and roleIn methods to check a user's role:

```
if($user->roleIs('admin)){
    //user is admin role
}

if($user->roleIn(['admin','manager'])){
    //user is admin or manager role
}
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity63

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

Unknown

Total

1

Last Release

3243d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c822712c569f6acbe0b8dd58d30eab4f6f68e585fbdfe1a727154b22aef86bba?d=identicon)[kilroyweb](/maintainers/kilroyweb)

---

Top Contributors

[![kilrizzy](https://avatars.githubusercontent.com/u/132478?v=4)](https://github.com/kilrizzy "kilrizzy (2 commits)")

---

Tags

laravel

### Embed Badge

![Health badge](/badges/kilroyweb-roles/health.svg)

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

###  Alternatives

[rtconner/laravel-likeable

Trait for Laravel Eloquent models to allow easy implementation of a 'like' or 'favorite' or 'remember' feature.

394388.0k5](/packages/rtconner-laravel-likeable)[hemp/presenter

Easy Model Presenters in Laravel

247592.6k1](/packages/hemp-presenter)[slowlyo/owl-admin

基于 laravel、amis 开发的后台框架~

61214.2k26](/packages/slowlyo-owl-admin)

PHPackages © 2026

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