Adam Griffiths' Open Source Libraries


Installation

Installing AG Auth is very simple, with only 5 steps to get going.

Step 1

Download the files from Github

Step 2

If this is your first time using the library, create a new database and run the query in dump.sql (MySQL only). This will set up the user table.

You will also need to change your base URL, and other general changes when using CodeIgniter. Please consult the CodeIgniter user guide directly.

Open up config.php and set $config['sess_use_database'] to TRUE.

Open up routes.php and copy AG Auth routes over to your own application's routes.php file.

Note:  You need to set an encryption key in the config.php file. Once this is set you must not change it as this will break your application.

Step 3

If you have installed this library through the use of Sparks, you need to autoload this spark. Open up config/autoload.php and add in 'auth' to the sparks array. If you installed this library manually then you can skip this step.

You will also need to move the contents of the core library in the sparks folder to application/core as well as moving the config files from the sparks config folder to application/config/. As always, your controllers that make use of the library need to be contained inside of applications/controllers/.

Step 4

Try out AG Auth! Navigate to http://yourdomain.ext/index.php/register to set up a new user account. You should go into PHPMyAdmin or another equivalent package and edit the group_id to 1, so that the first user is an administrator.

To make things easier to work with and build upon the last version of AG Auth I have added the SQL for the groups table to both the dump.sql and upgrade.sql file. This will help when developing applications that need to show user groups.

Note:  The 'id' field is not set to auto-increment. Bare this in mind when developing an application to add groups etc.

Step 4

In many cases you may want to store your models, views and controllers in a sub folder for AG Auth Admin Panel. If this is the case (or you have changed the folder name from the default value) you can change these values inside of config/ag_auth.php.