PHPackages                             xiidea/ezrbac - 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. xiidea/ezrbac

ActiveCodeigniter-third-party[Authentication &amp; Authorization](/categories/authentication)

xiidea/ezrbac
=============

A simple yet easy to implement Role Based Access Control Library for Codeigniter

1.3.3(7y ago)8687338[8 issues](https://github.com/xiidea/ezRbac/issues)1MITPHPPHP &gt;=5.3.0

Since Mar 22Pushed 7y ago13 watchersCompare

[ Source](https://github.com/xiidea/ezRbac)[ Packagist](https://packagist.org/packages/xiidea/ezrbac)[ Docs](http://xiidea.github.io/ezRbac)[ RSS](/packages/xiidea-ezrbac/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (1)Versions (10)Used By (1)

ezRbac
======

[](#ezrbac)

A simple yet easy to implement Role Based Access Control Library for popular PHP framework Codeigniter

Key Features
============

[](#key-features)

- Easy to integrate with Codeigniter Application
- User Login system with password recovery integrated
- Easy To Customize!!!
- Integrated Access Control Management Interface
- Configurable DB Table name
- Support Clean Url routing!
- Easy to adapt existing schema just by editing config file!!
- Usable with your existing login system!
- [Api](./docs/api.md) to interact with library
- User meta table include profile data (like: name, address etc)for an user
- Mailer function override to send recovery email using your own function
- Configuration and view files can be overridden!
- Coming more....!!!

Current Stable Release
======================

[](#current-stable-release)

[v1.3.2 Released](https://github.com/xiidea/ezRbac/archive/1.3.2.zip)!

How To Install
==============

[](#how-to-install)

Installation of this library is simple 4 steps

1. Put **ezRbac** in the **third\_party** Directory of your application (or use [composer command](./docs/composer.md))
2. Run the SQL in schema directory or create three tables in your database manually.
3. Set `$config['enable_hooks'] = TRUE;` at **./application/config/config.php**
4. Set `$config['encryption_key'] = SOME_SECRET_KEY;` at **./application/config/config.php**
5. Add a hook in **./application/config/hooks.php**

```
$hook['post_controller_constructor'] = array(
    'class' => 'EzRbacHook',
    'function' => 'accessCheck',
    'filename' => 'EzRbacHook.php',
    'filepath' => 'third_party/ezRbac'
);
```

Map custom actions to access map
================================

[](#map-custom-actions-to-access-map)

Define a public function named access\_map in your controller something like bellow:

```
 public function access_map(){
        return array(
            'index'=>'view',
            'update'=>'edit'
        );
    }
```

The index of the array is the actual action name, and the value mapped to the access privileges configured as `$config['default_access_map'] = array("view", "create", "edit", "delete", "publish")`

\##Default credential

If you have imported the provided data.sql then the default credential is

```
user:       admin@admin.com
password:   123456

```

ezRbac Specific URL
===================

[](#ezrbac-specific-url)

logout url : `/index.php/welcome/index/rbac/logout`

acl manage url : `/index.php/welcome/index/rbac/gui`

If you have enabled the routing(see **How to eneable Routing**) then you can access all url like `/rbac/(logout|gui)`

How to enable Routing
=====================

[](#how-to-enable-routing)

Its easy to enable with 2 steps

1. Set `$config['use_routing'] = true;` at **./ezRbac/config/ez\_rbac.php**
2. set `$route['^(rbac)/(.+)$'] = $route['default_controller']."/index/$1/$2";` at **/application/config/routes.php** (where **rbac** can be replaced whatever you like by setting the `$config['ezrbac_url'] = 'rbac';` )

Customization
=============

[](#customization)

Most of the customization can be done through setting configuration values. you can customize configuration in two ways:

1. (The Easy way) Modify the configuration to match with your choice at **./third\_party/ezRbac/config/ez\_rbac.php**
2. (The Advanced way) Make a copy of **./third\_party/ezRbac/config/ez\_rbac.php** as **./application/config/ez\_rbac.php** or Create new file to override the default settings. These way whenever you do update the library, you do not need to worry about your configuration values.

You can override the view file also. just copy the view files into **/application/views/ezrbac/** and modify as per your need. Currently only views in **login** directory is extensible.

Configuration Options
=====================

[](#configuration-options)

- **public\_controller**
    type: array
    default : array()
    List of public controller which access will not be checked by our library
- **ajax\_no\_permission\_msg**
    type: string
    default : You do not have permission to perform this action! Message to return while performing an ajax request instead of viewing the full restricted page, so you can handle the situation by your self.
- **default\_access**
    type: boolean
    default : FALSE
    The default access for a unknown method TRUE for give access denied otherwise.
- **default\_access\_map**
    type: array
    default : array("view", "create", "edit", "delete", "publish")
    Access Map array Used by the system. You can name these as you like and you can add/remove access name.
- **autologin\_cookie\_life**
    type: int
    default : 2592000 (30 days)
    The time in second to remember user login session with remember me checked.
- **autologin\_cookie\_name**
    type: string
    default : ezrbac\_remember\_me
    The autologin cookie name used to store user data with remember me checked.
- **redirect\_url**
    type: string
    default : ""
    The redirect url if access denied for a resource url(should be a public controller). Leave it empty if you are not sure about this
- **login\_url**
    type: string
    default : ""
    If you like to handle login then set your login url(should be a public controller) here, Leave it empty to let me handle it!! when you handling login, use `$this->ezrbac->getCurrentUser($user)` to register the user session.
- **login\_session\_key**
    type: string
    default : access\_role
    Login check session key name, used to check if a user is logged in or not. Without modification of core library, you may use any of these: user\_id/user\_email/access\_role
- **password\_min\_length**
    type: int
    default : 6
    The password validation rule check for minimum length.
- **password\_recovery\_email**
    type: string
    default :
    The From email for password recovery email
- **password\_recovery\_email\_name**
    type: string
    default : EzRbac
    The From name for password recovery email
- **password\_recovery\_subject**
    type: string
    default : Password Reset Request
    The subject for password recovery email
- **auto\_login\_table**
    type: string
    default : user\_autologin
    The database table name used to store auto login data
- **user\_table**
    type: string
    default : system\_users
    The database table name used to store user data
- **user\_meta\_table**
    type: string
    default : user\_meta
    The database table name used to store user meta data
- **user\_role\_table**
    type: string
    default : user\_role
    The database table name used to store user role info
- **access\_map\_table**
    type: string
    default : user\_access\_map
    The database table name used to store Access Control List as per user role
- **schema\_user\_table**
    type: array
    default:

```
array(
    'id'                  => 'id',
    'email'               => 'email',
    'password'            => 'password',
    'salt'                => 'salt',
    'user_role_id'        => 'user_role_id',
    'last_login'          => 'last_login',
    'last_login_ip'       => 'last_login_ip',
    'reset_request_code'  => 'reset_request_code',
    'reset_request_time'  => 'reset_request_time',
    'reset_request_ip'    => 'reset_request_ip',
    'verification_status' => 'verification_status',
    'status'              => 'status'
);
```

The database field map for your existing system. Helpful to adapt your db without modifying the code!!

- **schema\_user\_role**
    type: array default:

```
array(
    'id'        => 'id',
    'role_name' => 'role_name'
);
```

The database field map for your existing system. Helpful to adapt your db without modifying the code!!

- **user\_meta\_user\_id**
    type: string
    default : `user_id`The foreign key name in user meta table
- **show\_password\_reset\_mail**
    type: boolean
    default : `FALSE`Enable showing the email on browser rather then sending it. for debug purpose. do not set true in the production
- **override\_email\_function**
    type: string|false
    default : `FALSE`You can use your own function to send email. if you set this value to 'name\_of\_your\_function'. `name_of_your_function($option)` will be called to send email where `$option = array('subject'=>'','from'=>'', 'from_name'=>'', 'to'=>'','body'=>'');`
- **enable\_ezrbac\_gui**
    type: boolean
    default : `TRUE`Enable or disable the management interface
- **ezrbac\_gui\_url**
    type: string
    default : `gui`
    Url identifier for ezrbac gui interface access
- **ezrbac\_password**
    type: string
    default : `hardtoremember`Password to access management interface of ACL
- **ezrbac\_url**
    type: string
    default : `rbac`Ezrbac specific url identifier.
- **use\_assets\_within\_package**
    type: boolean
    default : `TRUE`This configuration value tell the library from where it should use the resource. if set to true the js/css/images used in the library views will be served from the assets directory in package (helpful for quick setup). For advance user it will be better to copy the contents of assets directory in a web accessible location and set the `$config['assets_base_directory']='the/relative/path/of/assets/directory/from/root'`
- **assets\_base\_directory**
    type: string
    default : `rbac`Optional only used if you set the the `$config['use_assets_within_package']=false;`Then set the relative path of assets directory from root
- **use\_routing**
    type: boolean
    default : FALSE
    enable clean url for management interface by adding routing rule. if `$config['ezrbac_url']='rbac'` then you can add `$route['^(rbac)/(.+)$'] = $route['default_controller']."/index/$1/$2";` and set the value to true.

Dependencies
============

[](#dependencies)

To use this library you need **Codeigniter 3.0+**For older version use 2.x branch

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community22

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 90.1% 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 ~254 days

Recently: every ~389 days

Total

8

Last Release

2659d ago

### Community

Maintainers

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

---

Top Contributors

[![ronisaha](https://avatars.githubusercontent.com/u/1433652?v=4)](https://github.com/ronisaha "ronisaha (73 commits)")[![roniemicro](https://avatars.githubusercontent.com/u/2525430?v=4)](https://github.com/roniemicro "roniemicro (7 commits)")[![mishbah](https://avatars.githubusercontent.com/u/2609046?v=4)](https://github.com/mishbah "mishbah (1 commits)")

---

Tags

codeigniterrole-based-access-control

### Embed Badge

![Health badge](/badges/xiidea-ezrbac/health.svg)

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

###  Alternatives

[codeigniter4/shield

Authentication and Authorization for CodeIgniter 4

417372.4k22](/packages/codeigniter4-shield)[myth/auth

Flexible authentication/authorization system for CodeIgniter 4.

641147.9k14](/packages/myth-auth)[yidas/codeigniter-rest

CodeIgniter 3 RESTful API Resource Base Controller

8215.7k2](/packages/yidas-codeigniter-rest)[tatter/permits

Model permission handling for CodeIgniter 4

1443.0k2](/packages/tatter-permits)[casbin/codeigniter-permission

Associate users with roles and permissions, use Casbin in CodeIgniter4 Web Framework.

443.0k](/packages/casbin-codeigniter-permission)[hosseinhezami/laravel-permission-manager

Advanced permission manager for Laravel.

403.3k](/packages/hosseinhezami-laravel-permission-manager)

PHPackages © 2026

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