PHPackages                             andri-sudarmawijaya/smartyacl - 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. andri-sudarmawijaya/smartyacl

ActiveCodeigniter-third-party

andri-sudarmawijaya/smartyacl
=============================

Lightweight Auth System with ACL for CodeIgniter 3

V1.3.alpha(4y ago)013MITPHP

Since Aug 16Pushed 4y agoCompare

[ Source](https://github.com/andri-sudarmawijaya/SmartyAcl)[ Packagist](https://packagist.org/packages/andri-sudarmawijaya/smartyacl)[ RSS](/packages/andri-sudarmawijaya-smartyacl/feed)WikiDiscussions packagist Synced 3d ago

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

Smarty ACL
----------

[](#smarty-acl)

SmartyACL is a library with basic authentication and authorization functions for Codeigniter 3. This library was based on Ion Auth but with the addition of ACL / RBAC and some other features.

### Features

[](#features)

- Register
    - Register admin or user
    - Send mail verification (optional)
- Login
    - Single or Multi login(email, username or both)
    - Limit max attempts
    - Remember me
    - Checks account status(inactive or banned) (optional)
    - Check mail verification (optional)
- Forgot Password
    - Send reset password mail
- Reset Password
    - Validate security code and update user email/password
- Roles
    - Create, update, delete
    - Assign module permissions
- Modules
    - Create, update and delete
- Admin Group - Users with role/permission access
- User Group - Common users without role/permission access
- Cache data to improve performance (optional)

### Summary

[](#summary)

- [Requirements](#requirements)
- [Demo](#demo)
- [Installation](#installation)
- [Default Login](#default-login)
- [Usage](#usage)
- [Contributing](#contributing)
- [Support](#support)
- [References](#references)

### Requirements

[](#requirements)

- Codeigniter 3 (developed on 3.1.11)
- PHP 7.x (developed on 7.3)

### Demo

[](#demo)

Download a demo application [here](https://github.com/rubensrocha/codeigniter-smarty-acl-demo)

### Installation

[](#installation)

1. Download latest released version
2. Put SmartyAcl folder on `application/third_party` directory or install using composer ```
    composer require andri-sudarmawijaya/smartyacl:1.0.x-dev

    ```
3. Add to `$autoload['packages']`¹ in `application/config/autoload.php````
    $autoload['packages'] = array(APPPATH.'third_party/SmartyAcl');

    ```
4. Import DB tables using migration or database.sql file
5. Config library preferences on `application/third_party/SmartyAcl/config/smarty_acl.php`

¹ Alternatively, you can copy the contents of the SmartyAcl folder to the respective directories in the application folder and load the library directly into the controller using `$this->load->library('smarty_acl');`

### Default Login

[](#default-login)

Username: admin
Password: 123456

### Usage

[](#usage)

Methods List

MethodDescription[register()](#register-admin)Register a new Admin User[register\_user()](#register-user)Register a new User[login()](#login)User or Admin Login[activate()](#activate-admin-or-user)Activate admin user with code(email)[activate\_user()](#activate-admin-or-user)Activate user with code(email)[resend\_activation()](#resend-activation-mail)Resend email confirmation code (admin/user)[forgotten\_password()](#forgotten-password)Send reset password email (admin/user)[forgotten\_password\_check()](#forgotten-password-check)Validate forgotten password code (admin/user)[reset\_password()](#reset-password)Reset email and password (admin/user)[logged\_in()](#logged-in)Check if user is logged in (admin/user)[logout()](#logout)Logout current logged in user (admin/user)[roles()](#get-roles)Get roles list[role()](#get-role)Get single role[create\_role()](#create-role)Create a new Role[update\_role()](#update-role)Update a single Role[delete\_role()](#delete-role)Delete a single Role[modules()](#get-modules)Get modules list[module()](#get-module)Get single module[create\_module()](#create-module)Create a new Module[update\_module()](#update-module)Update a single Module[delete\_module()](#delete-module)Delete a single Module[module\_permissions()](#get-module-permissions)Get a single Module Permissions[authorized()](#authorized)Check if logged in user is authorized to access current module[module\_authorized()](#module-authorized)Check if logged in user has permission to a specific module[authorized\_action()](#authorized-module-action)Check if logged in user has permission to current module action method[has\_permission()](#has-permission)Check if logged in user has permission to a specific module action method[admins()](#get-admins)Get admins[users()](#get-users)Get users[get\_user()](#get-user)Get a single user[get\_admin()](#get-admin)Get a single admin[update\_user()](#update-user)Update a single user (admin/user)[delete\_user()](#delete-user)Delete a single user (admin/user)[set\_delimiter()](#errors-delimiters)Set delimiters for error messages[errors()](#error-messages)Show error messages#### Register Admin

[](#register-admin)

Call:

```
$this->smarty_acl->register($identity, $password, $email, $additional_data, $role_id);
```

Responses:

```
int = user registered
array = user data array if verification is enabled but 'email_sender' is disabled
false(bool) = failed to register

```

FieldRequiredInfo$identityyesfield used to register/login user (username, email, phone, etc)$passwordyesuser password$emailyesuser email address$additional\_datanoarray with additional data(name, address, country, etc) (optional)$role\_idnorole id to assign(optional). If null, will use `$config['default_role']`#### Register User

[](#register-user)

Call:

```
$this->smarty_acl->register_user($identity, $password, $email, $additional_data, $role_id);
```

Responses:

```
int = user registered
array = user data array if verification is enabled but 'email_sender' is disabled
false(bool) = failed to register

```

FieldRequiredInfo$identityyesfield used to register/login user (username, email, phone, etc)$passwordyesuser password$emailyesuser email address$additional\_datanoarray with additional data(name, address, country, etc) (optional)#### Login

[](#login)

Call:

```
$this->smarty_acl->login($identity, $password, $remember, $admin);
```

Response:

```
(bool) = true if logged in

```

FieldRequiredInfo$identityyesfield used to register/login user (username, email, phone, etc)$passwordyesuser password$adminno (default TRUE)(bool) set FALSE to user login#### Activate Admin or user

[](#activate-admin-or-user)

Call:

```
//Admin user
$this->smarty_acl->activate($user_id, $code);
//User
$this->smarty_acl->activate_user($user_id, $code);
```

Response:

```
(bool) = true if activated

```

FieldRequiredInfo$user\_idyesUser ID$codeyesActivation Security Code#### Resend Activation Mail

[](#resend-activation-mail)

Call:

```
$this->smarty_acl->resend_activation($email, $admin);
```

Response:

```
(bool) = true if sent successfully

```

FieldRequiredInfo$emailyesUser email address$adminno (default TRUE)(bool) set FALSE to use for users#### Forgotten Password

[](#forgotten-password)

Call:

```
$this->smarty_acl->forgotten_password($email, $admin);
```

Response:

```
(bool) = true if sent successfully

```

FieldRequiredInfo$emailyesUser email address$adminno (default TRUE)(bool) set FALSE to use for users#### Forgotten Password Check

[](#forgotten-password-check)

Call:

```
$this->smarty_acl->forgotten_password_check($code, $admin);
```

Response:

```
(bool) = false if code is invalid or expired
(array) = user data array

```

FieldRequiredInfo$codeyesSecret Code$adminno (default TRUE)(bool) set FALSE to use for users#### Reset Password

[](#reset-password)

Call:

```
$this->smarty_acl->reset_password($user, $email, $password, $admin);
```

Response:

```
(bool) = true if updated successfully

```

FieldRequiredInfo$useryesArray with current user data(from forgotten\_password\_check())$emailyesNew email address$passwordyesNew password$adminno (default TRUE)(bool) set FALSE to use for users#### Logged in

[](#logged-in)

Call:

```
$this->smarty_acl->logged_in($admin);
```

Response:

```
(bool) = true if user is logged in

```

FieldRequiredInfo$adminno (default TRUE)(bool) set FALSE to use for users#### Logout

[](#logout)

Call:

```
$this->smarty_acl->logout($admin);
```

Response:

```
(bool) = true if user is logged out

```

FieldRequiredInfo$adminno (default TRUE)(bool) set FALSE to use for users#### Get Roles

[](#get-roles)

Call:

```
$this->smarty_acl->roles($result);
```

Response:

```
Roles list as object or array

```

FieldRequiredInfo$resultno (default TRUE)(bool) set FALSE to return array#### Create Role

[](#create-role)

Call:

```
$this->smarty_acl->create_role($data);
```

Response:

```
(bool) = true if created

```

FieldRequiredInfo$datayesarray with role fields/values#### Get Role

[](#get-role)

Call:

```
$this->smarty_acl->role($role_id);
```

Response:

```
(object) = if found
(bool) = false if not found

```

FieldRequiredInfo$role\_idyesRole ID#### Update Role

[](#update-role)

Call:

```
$this->smarty_acl->update_role($role_id, $data);
```

Response:

```
(bool) = true if updated

```

FieldRequiredInfo$role\_idyesRole ID$datayesarray with role fields/values#### Delete Role

[](#delete-role)

Call:

```
$this->smarty_acl->delete_role($role_id);
```

Response:

```
(bool) = true if deleted

```

FieldRequiredInfo$role\_idyesRole ID#### Get Modules

[](#get-modules)

Call:

```
$this->smarty_acl->modules($result);
```

Response:

```
Roles list as object or array

```

FieldRequiredInfo$resultno (default TRUE)(bool) set FALSE to return array#### Create Module

[](#create-module)

Call:

```
$this->smarty_acl->create_module($data);
```

Response:

```
(bool) = true if created

```

FieldRequiredInfo$datayesarray with module fields/values#### Get Module

[](#get-module)

Call:

```
$this->smarty_acl->module($module_id);
```

Response:

```
(object) = if found
(bool) = false if not found

```

FieldRequiredInfo$role\_idyesRole ID#### Update Module

[](#update-module)

Call:

```
$this->smarty_acl->update_module($module_id, $data);
```

Response:

```
(bool) = true if updated

```

FieldRequiredInfo$role\_idyesRole ID$datayesarray with module fields/values#### Delete Module

[](#delete-module)

Call:

```
$this->smarty_acl->delete_module($module_id);
```

Response:

```
(bool) = true if deleted

```

FieldRequiredInfo$role\_idyesRole ID#### Get Module Permissions

[](#get-module-permissions)

Call:

```
$this->smarty_acl->module_permissions($role_id);
```

Response:

```
(array) = multidimensional array with
{
    [module_id] => {
        [permission_id] => [permission_method_name]
    }
}

```

FieldRequiredInfo$role\_idyesRole ID#### Authorized

[](#authorized)

Call:

```
$this->smarty_acl->authorized();
```

Response:

```
redirect to unathorized route if not authorized

```

#### Module Authorized

[](#module-authorized)

Call:

```
$this->smarty_acl->module_authorized($module);
```

Response:

```
(bool) = false if not authorized

```

FieldRequiredInfo$moduleyesModule Controller Name#### Authorized Module Action

[](#authorized-module-action)

Call:

```
$this->smarty_acl->authorized_action();
```

Response:

```
redirect to unathorized route if not authorized

```

#### Has Permission

[](#has-permission)

Call:

```
$this->smarty_acl->has_permission($permission);
```

Response:

```
(bool) = false if not authorized

```

FieldRequiredInfo$permissionyesModule Permission Name#### Get Admins

[](#get-admins)

Call:

```
$this->smarty_acl->admins($result);
```

Response:

```
Admins list as object or array

```

FieldRequiredInfo$resultno (default TRUE)(bool) set FALSE to return array#### Get Users

[](#get-users)

Call:

```
$this->smarty_acl->users($result);
```

Response:

```
Users list as object or array

```

FieldRequiredInfo$resultno (default TRUE)(bool) set FALSE to return array#### Get User

[](#get-user)

Call:

```
$this->smarty_acl->get_user($user_id);
```

Response:

```
User data as array

```

FieldRequiredInfo$user\_idyesUser ID#### Get Admin

[](#get-admin)

Call:

```
$this->smarty_acl->get_admin($user_id);
```

Response:

```
Admin data as array

```

FieldRequiredInfo$user\_idyesUser ID#### Update User

[](#update-user)

Call:

```
$this->smarty_acl->update_user($data, $user_id, $admin);
```

Response:

```
(bool) = true if updated

```

FieldRequiredInfo$datayesarray with user fields/values$user\_idyesUser ID$adminno (default TRUE)(bool) set FALSE to use for users#### Delete User

[](#delete-user)

Call:

```
$this->smarty_acl->delete_user($user_id,$admin);
```

Response:

```
(bool) = true if deleted

```

FieldRequiredInfo$user\_idyesUser ID$adminno (default TRUE)(bool) set FALSE to use for users#### Errors Delimiters

[](#errors-delimiters)

Call:

```
$this->smarty_acl->set_delimiter($start, $end);
```

Response:

```
(bool) = true if set successfully

```

FieldRequiredInfo$startyesStart delimiter (`,,`, etc)$endyesEnd delimiter (`,,`, etc)#### Error Messages

[](#error-messages)

Call:

```
$this->smarty_acl->errors();
```

Response:

```
(string) = for single error
(array) = for multiple errors

```

### Contributing

[](#contributing)

Feel free to contribute with corrections, optimizations or improvements. Just send a [Pull Request](https://github.com/rubensrocha/codeigniter-smarty-acl/pulls) with your contribution.

### Support

[](#support)

If you found a bug, [Create an Issue](https://github.com/rubensrocha/codeigniter-smarty-acl/issues). If you're having an issue with CodeIgniter or for general help with development I recommend checking out the [CodeIgniter Forums](http://forum.codeigniter.com/)

### References

[](#references)

- [Ion Auth](https://github.com/benedmunds/CodeIgniter-Ion-Auth) repository used as reference

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 52.9% 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

Unknown

Total

1

Last Release

1731d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/28795941?v=4)[Andri Sudarmawijaya](/maintainers/andri-sudarmawijaya)[@andri-sudarmawijaya](https://github.com/andri-sudarmawijaya)

---

Top Contributors

[![rubensrocha](https://avatars.githubusercontent.com/u/10297656?v=4)](https://github.com/rubensrocha "rubensrocha (9 commits)")[![andri-sudarmawijaya](https://avatars.githubusercontent.com/u/28795941?v=4)](https://github.com/andri-sudarmawijaya "andri-sudarmawijaya (8 commits)")

### Embed Badge

![Health badge](/badges/andri-sudarmawijaya-smartyacl/health.svg)

```
[![Health](https://phpackages.com/badges/andri-sudarmawijaya-smartyacl/health.svg)](https://phpackages.com/packages/andri-sudarmawijaya-smartyacl)
```

###  Alternatives

[moment/moment

Parse, validate, manipulate, and display dates in JavaScript.

48.1k2.1M37](/packages/moment-moment)[zenorocha/clipboardjs

Modern copy to clipboard. No Flash. Just 3kb gzipped https://clipboardjs.com

34.2k218.2k2](/packages/zenorocha-clipboardjs)[drupal-composer/drupal-project

Project template for Drupal 10 projects with Composer

1.6k829.0k](/packages/drupal-composer-drupal-project)[artgris/filemanager-bundle

FileManager is a simple Multilingual File Manager Bundle for Symfony

182420.8k9](/packages/artgris-filemanager-bundle)[goalgorilla/open_social

Open Social is a distribution for building social communities and intranets.

190458.8k](/packages/goalgorilla-open-social)[govcms/govcms

GovCMS Drupal Distribution

18997.1k3](/packages/govcms-govcms)

PHPackages © 2026

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