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

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

maplephp/roles
==============

Create and manage user roles.

v1.0.1(2y ago)173[1 PRs](https://github.com/MaplePHP/Roles/pulls)1Apache-2.0PHPPHP &gt;=8.0

Since Nov 29Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/MaplePHP/Roles)[ Packagist](https://packagist.org/packages/maplephp/roles)[ Docs](https://wazabii.se)[ RSS](/packages/maplephp-roles/feed)WikiDiscussions main Synced 1mo ago

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

Roles
=====

[](#roles)

Create and manage user roles

### Initiate

[](#initiate)

Initiate and set the current user role. This will usally come from the database.

```
use MaplePHP\Roles\Role;

$loggedInUserRole = 3;
$roles = new Role($loggedInUserRole);
```

### Specify the roles

[](#specify-the-roles)

Propagate the roles with permissions for specific page

```
$roles->set(Role::getRole("ADMIN"), "r=1&i=1&u=1&d=1");
$roles->set(Role::getRole("EDITOR"), "read=1&insert=1&update=1&delete=1");
$roles->set([
    Role::getRole("AUTHOR") => "r=1&i=1&u=1&d=0",
    Role::getRole("MEMBER") => "r=1&i=0&u=0&d=0",
]);
```

### Validate permissions

[](#validate-permissions)

Now you only need to validate the permissions with in every specific controller method

```
var_dump($roles->hasRead(), $roles->hasInsert(), $roles->hasUpdate(), $roles->hasDelete());
// Result: bool(true) bool(true) bool(true) bool(false)
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance46

Moderate activity, may be stable

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

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

Total

2

Last Release

895d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/724b188e785081275926c5b9c07082e2b3f4afb797efdda61eb1630457e17824?d=identicon)[wazabii](/maintainers/wazabii)

---

Top Contributors

[![wazabii8](https://avatars.githubusercontent.com/u/6400238?v=4)](https://github.com/wazabii8 "wazabii8 (1 commits)")

---

Tags

userroleuser-roles

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/maplephp-roles/health.svg)](https://phpackages.com/packages/maplephp-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)[sonata-project/user-bundle

Symfony SonataUserBundle

3465.6M44](/packages/sonata-project-user-bundle)[yajra/laravel-acl

Laravel ACL is a simple role, permission ACL for Laravel Framework.

112103.9k1](/packages/yajra-laravel-acl)[klaravel/ntrust

Role-Based Permissions for Laravel 5.3+

10126.7k1](/packages/klaravel-ntrust)[org_heigl/hybridauth

Lightweight Authentication Module for Zend-Framework 2 using the hybridauth-library

211.9k](/packages/org-heigl-hybridauth)

PHPackages © 2026

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