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

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

bu4ak/roles
===========

1.0.3(7y ago)0190MITPHPPHP &gt;=7.1.3

Since Feb 24Pushed 7y ago1 watchersCompare

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

READMEChangelog (3)Dependencies (1)Versions (5)Used By (0)

Very simple package with roles and middleware
---------------------------------------------

[](#very-simple-package-with-roles-and-middleware)

#### Installation:

[](#installation)

```
 composer require bu4ak/roles
 php artisan vendor:publish --provider="Bu4ak\Roles\RolesServiceProvider"
```

modify migration if you need

```
php artisan migrate
```

```
// add 'HasRoles' trait to 'User' model
class User extends Authenticatable
{
    use Notifiable, HasRoles;
    ...
```

#### Usage example:

[](#usage-example)

set `admin` (`manager` or `user`) role to user:

```
$user = User::first();
$user->assignRole(RoleType::ADMIN);
```

and add middleware `admin` (`manager` or `user`) to route:

```
Route::get('/', function () {
    return view('welcome');
})->middleware(MiddlewareType::ADMIN);
```

#### Also:

[](#also)

You can check user's role

```
$user->isAdmin();
$user->isManager();
$user->isUser();
```

and select all users with a specific role

```
User::admins()->get();
User::managers()->get();
User::users()->get();
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

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

Total

3

Last Release

2594d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0c0d396d755132b3ab1d4b7bb33ed9a4a150de9034aea632c16344daf809838f?d=identicon)[bu4ak](/maintainers/bu4ak)

---

Top Contributors

[![bu4ak](https://avatars.githubusercontent.com/u/17143820?v=4)](https://github.com/bu4ak "bu4ak (16 commits)")

---

Tags

laravelrolespermissions

### Embed Badge

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

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

###  Alternatives

[santigarcor/laratrust

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

2.3k5.4M43](/packages/santigarcor-laratrust)[jeremykenedy/laravel-roles

A Powerful package for handling roles and permissions in Laravel. Supports Laravel 5.3 up to 12.

1.0k826.8k7](/packages/jeremykenedy-laravel-roles)[hasinhayder/tyro

Tyro - The ultimate Authentication, Authorization, and Role &amp; Privilege Management solution for Laravel 12 &amp; 13

6712.1k2](/packages/hasinhayder-tyro)[smarch/watchtower

Front-end for the Shinboi Auth system of Users / Roles / Permissions in Laravel 5

523.0k](/packages/smarch-watchtower)

PHPackages © 2026

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