Model-View-Controller (MVC) architecture in PHP

Abhigyan Singh 12th Jul 2020

Model-View-Controller (MVC) has been widely accepted by developers. It is most used architecture for web development world. At first, it was introduced in Smalltalk but did not get much popularity but when this concept introduced in JAVA. It becomes more popular and famous. Currently, it is the first need for all web developers. Later, it introduced in PHP.

The main concept of this architecture is to separate the complete code into 3 modules:

  1. Model
  2. View
  3. Controller

What is Model in MVC

The Model is responsible for managing the data. It stores, retrieves data from the database. Here, all the data manipulation has done. So it contains all the logic part for a specific application.

What is view in MVC

The View is responsible for displaying the data that are retrieved from the Model and display it in a specific format. It can be just a template for website where all the designing happened. It can be just a HTML page.

What is controller in MVC

The controller is responsible for handling the model and view to work together. The controller receives a request from the client, invoke the model to perform the requested operations and send the data to the View. The view formats the data to be presented to the user, in a web application as an html output.

Authored By Abhigyan Singh

He is a continuous blogger and has blogged on different topic. He loves to surf Internet and always trying to get new Idea about new Technology and Innovations and sharing these great information to all the technology lovers.