Magento 2.0 Architecture

Magento 2 has an entirely different architecture in comparison to Magento. This blog clearly explains the structure of Magento 2 and also states the difference between the structure of Magento 2 and Magento 1. In the previous article (Magento 2 Widnows Installation/Magento 2 Linux Installation) we were done with Magento 2 installation , now let’s check out architecture of Magento 2.

Just like it’s predecessor Magento 1, Magento 2 also follows Configuration based MVC. Besides this, there are lots of new features and libraries are added in Magento 2 like Magento 2 now uses symphony autoloader, introduced jQuery support , etc.

Figure 1- Magento 2 architecture block diagram

Above image shows current magento 2.0 architecture which hopefully would remain same in future in the upcoming releases of magento 2, Following are some important terms used to describe the elements in the above magento 2 architecture image.

Checks php version (if php version is less than 5.5.0 then shows error message and exit execution.)

Sets default error reporting to “E_ALL”

Define base path of root directory

Initialize autoloader

Sets status of profiler

Sets default time zone to “UTC”

Initialize / Create App

Initialize object manager

Get main configuration array from /app/etc/config.php

Run App

Initialize error handler

Initialize object manager if not initialized till now.

Check maintenance mode is on or not if on then show maintenance page.

Check installation has completed or not if not then redirect it to /setup/index.php

Launch

Get/Set area code

Firstly it gets area code frontend or adminhtml

Then sets area code

Load config and configure

It loads configuration according to area

Get front controller instance and call dispatch function for routing

Routing

Routing is an algorithm for searching controller by current request. Router decides which controller need to be dispatched.

Figure 2 – Router matching process

Get active routers list with help of area’s di.xml

Search for front name, controller, and action in each router

If found controller in router then generator generates its interceptor class and instantiate it.

Call dispatch function of instance which will call original controllers action.

Controller

When controller and action is decided then execute function of action class is called. Here we can use model for business logic implementation. After implementing business logic’s it collects output by help of layouts, templates and blocks.

Figure 3 – Prepare layout for action

HTTP Response

After rendering complete output , Html will be sent to requesting Agent(Browser)

Output

In the end final requesting Agent will handle the output

Should you’ve any doubt, you’re most welcome to ask.

Thanks for your interest! Team CedCommerce

Like this:

Author of this post:

cedcommerce

Started in 2010, the company has been involved in over 1000 ventures of customizing solutions to address all the unique needs. Fuelled by its rich experience, the company has developed highly popular JET SHOPIFY INTEGRATION APP being used by 500+ sellers across the United States of America. And recently, it became the Official Channel Integration Partner of Walmart, Sears, and Newegg. The company offers all the products that make selling easier on e-commerce.

Post navigation

And finally, this modern, modular architecture reduces the complexity and cost of maintaining your site and it futureproofs your investment by simplifying upgrades. This means you can easily incorporate innovative functionality as it is released by Magento Commerce on a quarterly basis to drive higher sales and greater efficiency.

Namita

Thank you so much for this post. It was very useful for understanding Magento’s work flow. Please keep posting.

Glad you like the post. We have already posted some useful blog related to Magento2 Theme as well as Magento2 Module Creation which you can easily visit by navigating to other blog section . Your feedback & queries on them would be highly appreciated.

We Don't Spam, Promise!

Please Enter the valid Email id

Thank you for your subscription.

Here at Cedcommerce we love to socialize and make new friends, Connect with us today.