MVC Architecture

MVC is a software architectural pattern for implementing user interfaces on computers. It divides a given application into three interconnected parts. This is done to separate internal representations of information from the ways information is presented to, and accepted from the user.

  • MVC stands for "Model view And Controller".
  • The main aim of MVC Architecture is to separate the Business logic & Application data from the USER interface.
  • Different types of Architectures are available. These are 3-tier Architecture, N-tier Architecture, MVC Architecture, etc.
  • The main advantage of Architecture is Reusability, Security and Increasing the performance of Application.
PHP MVC Architecture

Model: Database operation such as fetch data or update data etc.

View: End-user GUI through which user can interact with system, i.e., HTML, CSS.

Controller: Contain Business logic and provide a link between model and view.

Let's understand this MVC concept in detail:

Model:

  • The Model object knows all about all the data that need to be displayed.
  • The Model represents the application data and business rules that govern to an update of data.
  • Model is not aware about the presentation of data and How the data will be display to the browser.

View:

  • The View represents the presentation of the application.
  • View object refers to the model remains same if there are any modifications in the Business logic.
  • In other words, we can say that it is the responsibility of view to maintain consistency in its presentation and the model changes.

Controller:

  • Whenever the user sends a request for something, it always goes through Controller.
  • A controller is responsible for intercepting the request from view and passes to the model for appropriate action.
  • After the action has been taken on the data, the controller is responsible for directly passes the appropriate view to the user.
  • In graphical user interfaces, controller and view work very closely together.
Next TopicPHP Tutorial




Contact US

Email:[email protected]

MVC Architecture
10/30