Magento MVC Architecture & Flow

08 / Mar / 2013 by shahid 1 comments

There are many systems in PHP that follows MVC  (Model-View-Controller) architecture.   It is a robust design pattern that separates data access, business logic and user interface code.

A typical MVC concept,

Model: consists of application data and business rules.  It communicates with the database get the information. In Magento, we have these files under “Model” folder of each module in any code pool be it core, local or community.

Controller: mediates input, converting it to commands for the model. These files decides action between model and view files. They can be found under “controllers” folder of each module in core, local or community code pool.

View: output representation of data like rendered HTML. In Magento, these files resides under template at app/design and have .phtml extension. These files have combination of PHP and HTML code as well as $this object to refer to Model for data structure.

But Magento is based on more abstract MVC  pattern. Refer the below diagram


  1. URL is taken by a single PHP file and Magento application is instantiated
  2. Application instantiate Front Controller Object
  3. Front Controller instantiate Routers
  4. Routers check URL and determines Controller and Actions
  5. Action Methods manipulate Models
  6. Action loads layout and kicks off rendering
  7. Templates, via Blocks, read from Models
  8. Blocks and Child Blocks render into HTML page

Note: Unlike other MVC patters, Magento Blocks refer to the Models for their data as Action Controller does not pass them data structure.


comments (1 “Magento MVC Architecture & Flow”)

  1. Jewel

    I loved as much as you will receive carried out right here.
    The sketch is tasteful, your authored subject matter stylish.
    nonetheless, you command get bought an shakiness over that you wish be delivering the
    following. unwell unquestionably come further formerly
    again since exactly the same nearly very often inside case you shield this hike.

    Feel free to surf to my blog august birthstone (Jewel)


Leave a Reply

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