MVC – model view controller architecture in php

MVC – model view controller architecture is a pattern that break an application into three parts model, view and controller. This approach helps us to organize an application in a better way. There are lots of PHP frameworks that uses MVC architecture.

 

Controller  =>     Input

Mode          =>     Process

View           =>     Output

 

Model – Model defined the data structure. Model is the mediator between view and controller. It manages the data and business logics. If there is any change in data, it will notify to controller or view to make changes according to that.

View – View is used for representation of information. It will define how our data should display. For web application view is the part where all the html written. We can say it’s kind of presentation layer.

Controller – Last but not the least controller is work as a collection agent. It takes input form users and passes it to model to perform the requested inputs. Controller is connected to the model and the view to process the data flow.

 

Benefits of MVC

  • Code reusability
  • Fast development process
  • Clean and managed code
  • Multiple view support
  • Provide test driven environment
  • Provide seo friendly url

 

Php frameworks based on MVC

  • Cakephp
  • Codeigniter
  • Zend
  • Symfony
  • Yii
  • Kohana