Light authentication library for codeigniter 2.x. It supports groups and privileges and is equipped with many powerful functions.
Switch branches/tags
Nothing to show
Clone or download
Latest commit 4777257 Nov 11, 2014
Type Name Latest commit message Commit time
Failed to load latest commit information.
CI_AuthLTE_documentation Generated functions list Oct 10, 2013
application Fix author info Nov 11, 2014
CI_AuthLTE_db.sql Updated documentation Oct 10, 2013
LICENSE Update LICENSE Oct 9, 2013 Docs update Oct 11, 2013


Beta version 0.1.0 has been released.

CI_AuthLTE is a light authentication library for codeigniter 2.x.


PHP 5.3 or higher

Codeigniter 2.x or higher

MySQL database

Main Features

1- PHPass for password encryption

2- Limited login attempts

3- Secured "remember me" with limited time period

4- Forgetton password help

5- Optional activation email

6- Groups and priviledges control

7- Simple database structure

Quick Start


Add the files to the corresponding directories. Then, dump the sql file to your database. Open the auth_model.php file which is located in the Application/models directory. Make sure to edit the settings to match your desire.

To initialize the library, load the model using Codeigniter's load function in your controller:


Creating an account:

To create an account simply use the create_account() function. Example:

$user_id = $this->auth_model->create_account($email, $password);

You can add customized columns to the accounts table such as phone and name. Then you can use the 4th parameter of the create_account() function to add custom data to your table. Example:

$custom_data = array(
					"name"  => "Foo Bar",
					"phone" => "555-555-5555"
$user_id = $this->auth_model->create_account($email, $password, NULL, $custom_data);

If you want the account to be connected to a group, add the group id as a 3rd paramater.

Logging In:

Log a user in using the login() function. Example:

$this->auth_model->login($email, $password, $remember_me = FALSE);

The function will return (bool) TRUE on success. False otherwise.

Checking If the User is Logged in


Get Current User ID

$user_id = $this->auth_model->user_id();

Getting and Setting Error and Status Messages

The error and status messages are stored in the language file included with the library. To set a customized message, add your message to the language file. For example:

$lang['auth.custom_error'] = 'The fields %s and %s are invalid!';
$lang['auth.email_field'] = 'Email';
$lang['auth.password_field'] = 'Password';

Then use the set_error_message() or set_status_message() by passing the $lang key to the function. The second param is optional and used to pass data to the sprintf function. For example:

//Or using the second param
$this->auth_model->set_error_message('auth.custom_error', lang('auth.email_field'));
//You can also pass an array as a second paramater.
$sprintf = array(
$this->auth_model->set_error_message('auth.custom_error', $sprintf);
//Similarly, you can use the set_status_messages()

To retrieve a message, use error_messages() or status_messages(). For example:

//You can choose the opening and closing tags for each message (line)
//Returned value: <p>first error</p><p>second error</p> ... and so on
$errors = $this->auth_model->error_messages('<p>', '</p>');

For a full list of the library's functions, download the CI_AuthLTE_documentation folder and open the index.html file.