Back to top

PHP in MVC framework

The key concept of MVC framework is modularity. Instead of developing a monolithic application, we divide the application into three major components.

  • In one of the component, we can define all our database related procedures. This component is called model

  • In another component, we can design all the dynamic web pages, user input forms along with their css codes. This component is called view.

  • Finally, the third component shall control these two components and manage the flow control of the application. This component is called controller.

This way, the application will be much better maintained. 

Let us assume that a team of developers comprising of a lead PHP progammer, a MYSQL database adminsitrator and a CSS designer is woking on this application. With MVC framework, we can make sure that each of the team member is responsible for a specific component of the application.

Database administrator will only be concerned with the models whereas CSS developers will only be working with the views. Likewise, the lead programmer will be responsible for managing the models and views through the controllers.


We will be using CodeIgniter as the MVC framework.

We will start from the point where we are able to access CodeIgniter's interface from our web browser at http://localhost/ci

For sake of understanding, we will break this article into two components.

Part I: CodeIgniter basics

Part II: Application development

Prerequisite: Object Oriented Programming with PHP and MYSQLI