model view controller php

PHP MVC application: Model, View and Controller

Posted by

MVC stands for Controller-View-Model is a method of application design, separating application data and business logic (model) from the presentation (view). PHP MVC application is a designing pattern to develop an application.

The controller works as a mediator between the models and views.

The pattern of PHP MVC Design

Let’s talk in brief about the three components of MVC:

Model: The Model object understands all the data which needs to be shown. The Model reflects the application data and business rules that control the modification of data. The model doesn’t know how data will be transmitted to the user and how the data will be interpreted. The data can come from a file, XML document, database(Mysql, MongoDB, Microsoft SQL Server, PostgreSQL, etc), Other valid data sources.

View: The View reflects the request to be viewed. View object refers to the model remains the same if there are any changes to the Business logic. We can say that maintaining consistency in its presentation and changes in the model is the responsibility of the perspective. Usually, it is in the form of HTML pages.

Controller: If a user sends a request for something, it goes through the Controller, at first. The controller is liable to catch the request from the view and pass it on to the model for appropriate action. After the action has been taken on the results, the controller is responsible for directly transferring the appropriate view to the user. The controller and view work very well in graphical user interfaces.

Here is some list of PHP framework:

Laravel: Laravel is a robust, easy to understand, an open-source PHP framework. It follows the design pattern of a model-view-controller. Laravel reuses existing components from various frameworks that help to build a web application. The so built web application is more organized and pragmatic.

Codelgniter: Codelgniter is a free, open-source PHP framework. It follows the design pattern of the Model-View-Controller(MVC). CodeIgniter provides modules, a graphical interface and a logical framework to access these modules, plug-ins, helpers, and several other resources that make it easier to maintain the high performance of complex PHP functions.

Symfony: Symfony is a collection of modular PHP modules and a web application development architecture for web applications, APIs, microservices, and web services. The developer can build a simple and elegant toolkit to build a full- web application. It’s an open-source PHP framework.

CakePHP: CakePHP is an open-source PHP framework that helps make the application for development and maintenance much easier. It is based on the architectural concept of the Model View Controller(MVC). It helps separate your business logic from data and the layers of presentation.

Leave a Reply

Your email address will not be published. Required fields are marked *