Here we will understand the architecture and working of the CodeIgniter application, which helps you to elaborate all steps in simple ways.

CodeIgniter Architecture

As the above image represents that whenever a request comes from the CodeIgniter application, firstly, it will go to the index.php file.

In the second step, the request passes via an index.php page to Routing for deciding whether the request passes to a cache file (step 3) or the step4 for security check.

If the user requested page is already in caching file, then the router doesn’t need to go step 3 for further updating, and the response will revert to the user.

And if the user requested page does not exist in the caching file, then the routing will pass the request to security (step 4) check.

After testing the security check, your requested page will go to the Application controller. And the Application Controller will load all the necessary files like Models, Libraries, Helpers, Plugins, and Scripts then pass to the view.

A View is used to fetch the data from the Application Controller that will represent to the user, and they pass the data to the caching file to the fastest access.

CodeIgniter MVC Framework

The CodeIgniter application is based on the MVC (Model – View – Controller) approach. MVC is a software, which distinct the application logic from the presentation view. Due to the separation of presentation view from the php scripting, it allows your web pages to minimize the script.

CodeIgniter Architecture2

Model

A model is used to interact with the database. When a user requested the particular data from the application, then the model has the responsibility to fetch the records from his database table. It also represents a data structure in which you can perform many operations like insert, update, delete, and retrieve.

Controller

As the name suggests, the controller, which means to control the working of the CodeIgniter application. It works as a mediator between the model and the view. So, it has the responsibility to takes the request from the user and handle that request by providing an appropriate result from the model. And it displays the appropriate records to the user by using the view component.

Note: 1. The Controller file name should be in the uppercase letter. Example – Main.php

2. The class name of the controller should be in the uppercase letter as the Controller File’s name.

View

A View is just like a web page. It contains the information shown to the user. A view can also be a part of a web page like header and footer. Also, you can represent the view page in RSS as well as a user interface.

Pin It on Pinterest

Share This