PHPackages                             mamikon/role-manager - 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. mamikon/role-manager

AbandonedArchivedLaravel-package[Authentication &amp; Authorization](/categories/authentication)

mamikon/role-manager
====================

Laravel Role And Permission Manager

1.0.5(9y ago)03511MITPHPPHP &gt;=5.6.4

Since Apr 13Pushed 9y agoCompare

[ Source](https://github.com/mamikon/role-manager)[ Packagist](https://packagist.org/packages/mamikon/role-manager)[ RSS](/packages/mamikon-role-manager/feed)WikiDiscussions master Synced 2w ago

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

RoleManager
===========

[](#rolemanager)

[![Latest Version on Packagist](https://camo.githubusercontent.com/9eae3e1ef793914b8f207b8207d727b46e3cd5b168d0f90df7eb5c4ec78b8db7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d616d696b6f6e2f726f6c652d6d616e616765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mamikon/role-manager)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/1f98c75df263d06988f1e6c40d565f2d2008d861518933778cc92f89755f0c15/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6d616d696b6f6e2f726f6c652d6d616e616765722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/mamikon/role-manager)[![Coverage Status](https://camo.githubusercontent.com/cec3923cf9c18a86ceaa3e948cb82895ea8069d92a44fe9ef5712de5206cdbf4/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6d616d696b6f6e2f726f6c652d6d616e616765722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/mamikon/role-manager/code-structure)[![Quality Score](https://camo.githubusercontent.com/0f04e747c1812c5a4d123b0ccaa41686716afc87699af42b845abe2f806b2bd0/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6d616d696b6f6e2f726f6c652d6d616e616765722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/mamikon/role-manager)[![Total Downloads](https://camo.githubusercontent.com/9b60f3195785acb4987e5e738b99d245dab486555e5a95bdd03776ecab807c20/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d616d696b6f6e2f726f6c652d6d616e616765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mamikon/role-manager)

Role and permission management system for laravel. This package impalement Role Management in Laravel. And you can create in easy way new permissions and assign them to the roles.

Install
-------

[](#install)

Via Composer

```
$ composer require mamikon/role-manager
```

Then add the ServiceProvider to the providers array in `config/app.php`.

```
Mamikon\RoleManager\RoleManagerProvider::class,
```

You can use the facade for shorter code. Add this to your aliases:

```
'RoleManager' => Mamikon\RoleManager\RoleManagerFacade::class,
```

To publish the config settings use:

```
 $ php artisan vendor:publish --provider="Mamikon\RoleManager\RoleManagerProvider"
```

It will publish default views for Role and permission management and `roleManager.php` config file.

Before starting lets go over config file and make some configurations.

Config file contain default permissions, roles.

It will create some permissions for RoleManager package, after publishing package you can add some new permissions right there and it will be more preferable than from admin panel, it will make your application more easy shippable. Each permission must contain array key, it will be name of permission, and value of that key must be an array which contain description. in addition of this you can add class and method that will make additional checking for that permission

```
'edit_post' => [
    'description' => "Edit Post",
    'class' => App\Permissions\Post::class, // not required
    'method' => 'canEdit', // not required
],
```

Then You can create default roles. Each array element must contain key which will be role name, and value- that will be description of our role

```
'super-admin' =>  "Can Do everything",
```

Then You can assign some permissions to roles.

```
'assignPermissionsToRole'=> [
    'editor' => [
            'edit_post',
            'publish_post',
            //...
        ]
 ],
```

You can use asterisk for add all permissions to that role

```
'assignPermissionsToRole'=> [
   'super-admin' => '*'
],
```

Then you can add roles to users

```
'assignRoleToUser' => [
    'super-admin'=>'admin@pass.com',
    'editor'=>'editor@pass.com',
 ],
```

All this configurations will be loaded after run artisan command `permission:migrate`

```
$ php artisan permissions:migrate
```

But before that we must migrate our tables. It by default will create 4 tables

- permissions
- roles
- roles\_user
- permissions\_roles

If in your database exist tables permissions, and roles you can change their names from config file and then migrate

```
    'permissionsTable'=>'other_permissions',
    'rolesTable'=>'other_roles',
```

RoleManager package will create routes for Role management control pages

- /
- /role(resource)
- /permission(resource)
- /user/{id}

And they will be prefixed by default with `role-manager`.

```
'routePrefix'=>'role-manager',
```

By default views will be extend form `layouts.app`

```
'extendedView'=>'layouts.app',
```

If you don't want extend any view you can give value `false`And You must give section where must be extended

```
 'extendedSection'=>'content',
```

All configurations except default roles, permissions and default assignments can be loaded from `.env`

```
ROLE_MANAGER_PERMISSIONS_TABLE=permissions
ROLE_MANAGER_ROLES_TABLE=roles
ROLE_MANAGER_EXTENDED_VIEW=layout.app
ROLE_MANAGER_EXTENDED_SECTION=content
ROLE_MANAGER_EXTERNAL_BOOTSTRAP=false
ROLE_MANAGER_EXTERNAL_JQUERY=false
ROLE_MANAGER_ROUTE_PREFIX=role-manager
USERS_PER_PAGE=15
PERMISSIONS_PER_PAGE=15
ROLES_PER_PAGE=15

```

After all configuration will done run migration

```
$ php aritsan migrate
```

And then

```
$ php aritsan permissions:migrate
```

Usage
-----

[](#usage)

RoleManager don't change any logic in laravel authorization. You can use standard laravel facades, methods and functions.

```
if (Gate::allows('update-post', $post)) {
    // The current user can update the post...
}

if (Gate::denies('update-post', $post)) {
    // The current user can't update the post...
}
```

In addition RoleManager facade has 2 helper functions

- `RoleManager::assignRole(mixed $user, mixed $role)`
- `RoleManager::removeRole(mixed $user, mixed $role)`

As $user parameter can be User Model, or user\_id(int) As $role parameter can be Role Model, role\_id(int), or role name(string)

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Mamikon Arakelyan](https://github.com/mamikon)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community9

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

Total

4

Last Release

3365d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8920f171af17e2d65397e42ac2fef3dc583016f19fc421c453b8317552d94fb6?d=identicon)[mamikon1](/maintainers/mamikon1)

---

Top Contributors

[![mamikon](https://avatars.githubusercontent.com/u/7726989?v=4)](https://github.com/mamikon "mamikon (20 commits)")

---

Tags

laravelpermissionrole

### Embed Badge

![Health badge](/badges/mamikon-role-manager/health.svg)

```
[![Health](https://phpackages.com/badges/mamikon-role-manager/health.svg)](https://phpackages.com/packages/mamikon-role-manager)
```

###  Alternatives

[sereny/nova-permissions

Laravel Nova - Roles &amp; Permissions

87432.2k1](/packages/sereny-nova-permissions)[itstructure/laravel-rbac

Laravel package for RBAC manage

556.8k](/packages/itstructure-laravel-rbac)[cgross/laraguard

Permissions/roles for Laravel 5

388.9k](/packages/cgross-laraguard)[dlnsk/h-rbac

Based on native Laravel's gates and policies. Hierarchical RBAC with callbacks.

378.5k](/packages/dlnsk-h-rbac)

PHPackages © 2026

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