CodeIgniter Application Architecture

In the previous post, we know how to setup CodeIgniter on your local environment. To proceed with configuration it is very important to know Application Architecture. The CodeIgniter application Architecture looks like below:

Application architecture

Elaboration of CodeIgniter Architecture:

Above picture depicts that, the user interact with home/index page. An Index page consists of different directives of application.

  • At next level Routeing will determine whether it is available in cache or not. if it available in the cache then immediately route to the cache and generate a quick view to the user. Otherwise, it passes for security check.
  • At next level, the security check will check submitted data from the user then controller loads model, library, helper, plugins and necessary requirement for the request made by the user.
  • After gathering all required information from model, library, plugins etc, it passes to the View.
  • Then view will render the page with given data and pass it for caching if the requested page not cached before. After caching it will store in the cache for quick response in future as well as generate a view to the user.

Understanding with CodeIgniter File and Directory Structure:

The following picture will depict the overall CodeIgniter Directory Structure

Directory structure


In CodeIgniter application, basically there are three Directories those are:

  1. Application Directory
  2. System Directory
  3. User_guide

In addition, few files are there with the application licence, readme etc. you can create and use assets directory to manage your assets like uploads, scripts etc.

Elaboration of Files and its uses:

■ Application Directory

Application Directory contains the entire code of your application which you are developing.  In this directory, we found some subdirectories that have several functionalities. The following subdirectories are explained here:

  • Cache— This directory is used to store cached page of your application. Cache is a technique to serve page content faster to the user.
  • Config— The Config directory contains all configuration of your application. For example, Config.php contain the configuration of Base URL, Index file, URI Protocol etc. Database.php contains the configuration of the database like database driver, database name, username, password etc.
  • Controller— This directory contains all controller of your application. All directives of your application ar controlled from here.
  • Core— This directory contains all base classes of o your application.
  • Helpers— In this directory you can set your helper classes for the application.
  • Hooks— The Hooks feature provides a means to tap into and modify the inner workings of the framework without hacking the core files. For example, you might want to run a script right before your controllers get loaded, or right after, or you might want to trigger one of your own scripts in some other location.
  • Language— This folder contains language related files.
  • Libraries — All system library are contained in the system directory. But you can define your own library in the libraries directory.
  • Logs — This directory contains files related to the log of the system.
  • Models — The database related task like query, update and feedbacks are operated from this directory.
  • Third_party — In this directory, you can place any plugins, which will be used for your application.
  • Views — All Application’s HTML templates files contain in this directory.

■ System Directory

 System directory of CodeIgniter contains library, helper and core code which makes the development of your applications on this framework very easy. Do not change anythings in this directory. The subdirectories of system directory are explained below:

  • Core − This folder contains CodeIgniter’s core class. Do not modify anything here. All of your work will take place in the application folder. Even if your intent is to extend the CodeIgniter core, you have to do it with hooks, and hooks live in the application folder.
  • Database − The database folder contains core database drivers and other database utilities.
  • Fonts − The fonts folder contains font related information and utilities.
  • Helpers − The helpers folder contains standard CodeIgniter helpers (such as date, cookie, and URL helpers).
  • Language − The language folder contains language files. You can ignore it for now.
  • Libraries − The libraries folder contains standard CodeIgniter libraries (to help you with e-mail, calendars, file uploads, and more). You can create your own libraries or extend (and even replace) standard ones, but those will be saved in the application/libraries directory to keep them separate from the standard CodeIgniter libraries saved in this particular folder.

■ User_guide

This is your user guide to CodeIgniter. It is basically, the offline version of user guide on CodeIgniter website. Using this, one can learn the functions of various libraries, helpers and classes. It is recommended to go through this user guide before building your first web app in CodeIgniter.

The following two tabs change content below.

Subroto Mondal

Chief Coordinator HR&CR
I like Programming and New Technologies. And work with Linux.

Latest posts by Subroto Mondal (see all)

One Pingback

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.