After successful CodeIgniter Installation no need to understand CodeIgniter Architecture by which we can develop applications in a smooth way. As you know CodeIgniter is using model view controller based architecture. There are some dependencies upon different components inside CodeIgniter.

CodeIgniter Application Architecture

Whenever someone accesses the application the request goes to the index.php page. It is a very common practice in PHP frameworks.

From index.php request goes to the routing component which will decide to pass this request for caching component or Security component.

Index to Route and security

If the application page is already in the cache then the routing component will pass the response to the user right from the caching component.

In the case, if the application page is not already in the cache then the routing component will pass the page to the security component.

Before request goes to the application controller component security checks are measured from the security component. Right after that application controller execute or load the necessary modules such as models, libraries, helpers, scripts and plugins then it will send to the view.

Security to controller

Now view will render all the available resources which are passed from application controller and send that for Caching to Caching component. If the requested page was not before process by Caching component it’s getting Cache to load the page quickly in the future requests.

View to index

After understanding the application architecture in the CodeIgniter framework now it’s time to understand that directory structure.

Mainly it is divided into the three folders.

  • Application
  • System
  • User_guide

Application folder:

This folder contains all the essential code which we need to do develop the whole application. In other words, we can say that all the modules and subcomponents are available within this folder. There are some other folders are available within the application folder named as followed.

Cache – as we discussed in the application architecture in the above image. Views get cache for the better performance whenever user will need the same page again is Store within this folder.

Config – this folder contains the config file which is used to configure the Global variables of the whole application. By the users of the database file, we can configure the database for the current instance of the application.

Controllers – all the controller of application are saved in this folder.

Core – this folder contains the base classes of the application.

Helpers – in this folder you can save the helper classes for custom features.

Hooks – this folder will provide you the essential files by which you can manipulate the whole working framework without interrupting the core files.

Languages – language related files are saved within this folder.

Libraries – in this folder libraries files are saved even that custom libraries are also saved here.

Logs – this folder contains the log files which belongs to the application and system.

Models – in this folder all the models which belong to the application are saved.

Third_party – this folder is used to place external plugins or custom plugins which you will need to entertain in the whole application.

View – all the views of whole application received within this folder whatever they are HTML files for PHP files.

System Folder:

This folder contains all the essential files which help us to develop an application in an easy way. We can say that all the core files, helper classes, and libraries are available within this folder. These files are loaded and used in the development of the application. As the application folder is divided into the subfolders same is the case with system folder.

Following are the folders which are available within systems folder.

Core – this folder contains the essential classes which we need to develop the application if you will modify the core classes that may disturb your application. If you want to extend the features of the core classes then you can do that with the help of hooks.

Database – this folder contains the driver database development within the CodeIgniter. Such as the query builder drivers and other utilities which entertain database.

Fonts – this folder is used to save font related information and other utilities.

Helpers – this folder contains the standard CodeIgniter copying files and other utilities such as the date, cookie, and URL helper classes.

Language – in this folder all the language related files are saved.

Libraries – in this folder CodeIgniter essential libraries are saved. You can easily extend any one of these libraries or even that you can create your own libraries. All the libraries are saved in application/library folder if you are creating them by your own

User_guide Folder:

In this folder, the user guide is available to learn the CodeIgniter and its workflow. In short, it is the offline guide for developers. With the help of this guide, anyone can learn about the CodeIgniter and start developing an application with it. In this offline that there are many functionalities and features are available such as the different libraries and their uses along with the classes.

In all of these, we cannot forget to understand the importance of “index.php”. This file is used to define the Global variables for the application environment such as level of error and you can also define the name of the application folder. If you are just beginner with CodeIgniter then we are recommended not change anything within this file.