PHPackages                             feiron/fe\_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. feiron/fe\_roles

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

feiron/fe\_roles
================

Role management pkg offers role CRUD,gurds,etc.

2.0(5y ago)032Apache-2.0JavaScriptPHP &gt;=7.2.1

Since Jan 28Pushed 5y agoCompare

[ Source](https://github.com/yu0307/Fe_Roles)[ Packagist](https://packagist.org/packages/feiron/fe_roles)[ RSS](/packages/feiron-fe-roles/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (2)Versions (5)Used By (0)

Welcome to Fe\_Roles Repo
-------------------------

[](#welcome-to-fe_roles-repo)

### **Recommended to be used with [LaraFrame](https://github.com/yu0307/LaraFrame)**

[](#recommended-to-be-used-with-laraframe)

### Let's collaborate!

[](#lets-collaborate)

Email me for bugs, feature suggestions,pull requests,etc... or even hang out :)

### This package allows users to

[](#this-package-allows-users-to)

- Protect route by Permission or Role
- Protect contents by Permission or Role
- Protect route and contents by middlewares
- Manage list of Permissions or Roles
- Extend functionalities of Permission and Role management

### Dependencies:

[](#dependencies)

- Composer [Visit vendor](https://getcomposer.org/)
- PHP 7+
- Laravel 5+

### Installation:

[](#installation)

1. Please make sure composer is installed on your machine. For installation of composer, please visit [This Link](https://getcomposer.org/doc/00-intro.md)
2. Once composer is installed properly, please make sure Larave is up to date.
3. Navigate to your project root directory and run the following command to install Fe\_Roles

    ```
    composer require FeIron/Fe_Roles

    ```
4. This package is going to publish several files to the following path

    - config/fe\_roles/
    - public/feiron/fe\_roles/
5. **Important!** This package is also going to perform several migrations. Please refer to the following changes and make backups of your tables if they are present.
6. **Since I can't seem to have package auto publish assets**. make sure you run the following command at the end and every updates of this package.

    ```
        php artisan vendor:publish --provider="feiron\fe_roles\Fe_RolesServiceProvider" --force
        php artisan migrate --path="/vendor/feiron/fe_roles/src/database/migrations/"
        php artisan db:seed --class=\feiron\fe_roles\database\seeder\RoleSeeder
        php artisan Build:BuildUserClass

    ```

    **Important!** Command "Build:BuildUserClass" is ran to modify the user proivider class needed for the system. It modified the class(feiron\\fe\_roles\\models\\fe\_User.php) to inherit from the user provider class the system is currently using. This package will force the system to use class(feiron\\fe\_roles\\models\\fe\_User.php), therefore, we need to have the class inherit from the current user class.

    You can also instruct the system to use other user provider classes by making changes to the config file (/config/fe\_roles/appconfig.php) and modify the (target\_user\_model) parameter.
7. Seeding is also performed at the end of the migrations to create some stock permissions and roles.

    ```
    Schema to be Created/Modified
    [fe_roles]:
    id bigint(20) UN AI PK
    name varchar(191)
    description varchar(191)
    rank int(11)
    disabled tinyint(1)
    created_at timestamp
    updated_at timestamp
    ------------------------------------------
    [fe_abilities]:
    id bigint(20) UN AI PK
    name varchar(191)
    description varchar(191)
    disabled tinyint(1)
    created_at timestamp
    updated_at timestamp
    ------------------------------------------
    [fe_abilities_targets]:
    ability_id bigint(20) UN PK
    target_id varchar(36) PK
    target_type varchar(50) PK
    disabled tinyint(1)
    created_at timestamp
    updated_at timestamp
    ------------------------------------------
    [fe_role_targets]:
    role_id bigint(20) UN PK
    target_id varchar(36) PK
    target_type varchar(50) PK
    disabled tinyint(1)
    created_at timestamp
    updated_at timestamp
    ------------------------------------------
    [fe_role_abilities]:
    role_id bigint(20) UN PK
    ability_id bigint(20) UN PK
    disabled tinyint(1)
    created_at timestamp
    updated_at timestamp
    ------------------------------------------
    [fe_groups]:
    id bigint(20) UN AI PK
    name varchar(191)
    description varchar(191)
    disabled tinyint(1)
    created_at timestamp
    updated_at timestamp

    ```

**Note**: During migration, if you encounter error showing "Specified key was too long" This was due to MySQL version being older than 5.7.7, if you don't wish to upgrade MySQL server, consider the following.

Within your AppServiceProvider ``` use Illuminate\\Support\\Facades\\Schema;

```
/**
* Bootstrap any application services.
*
* @return void
*/

public function boot()
{
    Schema::defaultStringLength(191);
}
```

```

Further reading on this could be found at [This Link](https://laravel.com/docs/master/migrations#creating-indexes)

### Basic Usage:

[](#basic-usage)

**note:** You can create your own user provider class by either inherit from \\feiron\\fe\_roles\\models\\fe\_User.php or simply use trait "feiron\\fe\_roles\\lib\\traits\\fe\_user\_traits" in your current user provider class.

1. Protecting Routes: **note** multiple role/permission names can be seperated by "|".
    - Chain methods (role,permission,etc) in route definitions:

    ```
        Route::get('test', 'controller@method')->name('routename')->role("admin|editor");

    ```

    - Use middleware(ProtectByRoles,ProtectBypermission,etc) and pass in list of checks as parameters:

    ```
        Route::get('test', 'controller@method')->name('routename')->middleware('ProtectByRoles:admin|editor');

    ```

    Or in a controller definition: ```
        class testController extends Controller{

            public function __construct()
            {
                $this->middleware('ProtectBypermission:admin|editor')->except('logout');
            }
        }

    ```
2. Protecting Contents: within blade files, use the following directives to check for access levels: ```
        ...

        General visible contents ...
        @role([admin,editor])
            this is protected by role admin and editor.
        @endrole

        @permission(read)
            this is protected to those who can read.
        @endpermission

        ...

    ```

### configuration:

[](#configuration)

**Important**. There is a configuration file being published to /config/fe\_roles/appconfig.php. Proper configuration is required. Sample config:

```
return [
    'target_user_model'=> 'App\User',
    'usr_provider'=> \feiron\fe_roles\models\fe_User::class,
    'user_name_field'=> false,
    'user_password_field' => false,
    'user_remember_token_field' => false
];

```

Explainations:

option nameValuesDescriptionDefaulttarget\_user\_modelstringModel class used by the system to handel user storage.requiredusr\_providerstringClass file used by the system user and guard provider.requireduser\_name\_fieldstringTable field name used to store user names.falseuser\_password\_fieldstringTable field name used to store user passwords.falseuser\_remember\_token\_fieldstringTable field name used to store user expiration tokens.false### Permission/Role Management Feature

[](#permissionrole-management-feature)

This package provides many useful permission/role management features along with the ability to extend management feature.

### **Manage user roles and permission is enabled with the use this package jointly with [LaraFrame](https://github.com/yu0307/LaraFrame) and [Fe\_Login](https://github.com/yu0307/Fe_Login).**

[](#manage-user-roles-and-permission-is-enabled-with-the-use-this-package-jointly-with-laraframe-and-fe_login)

LaraFrame Support
-----------------

[](#laraframe-support)

This package was tailored to work with [LaraFrame](https://github.com/yu0307/LaraFrame).

- Permission/Role management is easily done through the shared control panel/interface provided by the framework.
- Permission/Role information can be jointly managed under user profile.
- Manage user permission and roles made easy with the framework.
- Outlets are automatically carried into the framework and making permission/role information related management a breeze.

Support us:
-----------

[](#support-us)

If you like this project, Please, please, please consider put a Star⭐️ and tweet about it.

I would love for any forms of supports and they are deeply appreciated👍! Thanks!

###  Health Score

25

—

LowBetter than 36% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity55

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

Total

3

Last Release

1910d ago

Major Versions

1.1 → 2.02021-04-01

PHP version history (2 changes)1.0PHP ^7.2.1

1.1PHP &gt;=7.2.1

### Community

Maintainers

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

---

Top Contributors

[![yu0307](https://avatars.githubusercontent.com/u/5016266?v=4)](https://github.com/yu0307 "yu0307 (21 commits)")

---

Tags

composerfe-roleslaravellaravel-frameworklaravel-packagephp-frameworkrolerole-managementrole-manager

### Embed Badge

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

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

###  Alternatives

[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135212.4k7](/packages/statamic-rad-pack-runway)

PHPackages © 2026

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