Have your eCommerce website built in Magento platform by opting our Magento 2 development services.
There is a lot of buzz around Magento 2 and about its new features that promises to improve user experience and performance.
One of the key changes made is in the request flow (i.e.) the path taken by the system from the time an user clicks a page to the time it is served as a page in the front end.
In Magento 1, both the front end and back end configuration files will be loaded for each request. But in Magento 2, only the related configuration files of that area will be loaded.
E.g. in Magento 1.x, if you click “Registration” Page in the front end, it loads the entire configuration files including the front end and the back end. But in Magento 2, it will load only the configuration file related to the front end.
This greatly improves the performance (i.e.) request-response time of the website thus enhancing the user experience.
In this blog, we will discuss the request flow in Magento 2.
Step 1 :
Request hits index.php in root folder of Magento 2.
Step 2 :
index.php calls static create() method of bootstrap class to create objectmanagerfactory and bootstrap objects.
Step 3 :
index.php calls createApplication() method of bootstrap object which in turn will initiate ObjectManager using objectManagerFactory. Then, application instance gets created using objectManager and returned to index.php.
Step 4 :
index.php calls run() method of bootstrap object to run the application, which in turn will call launch() method of application object.
Step 5 :
HTTP Application instance does initial routing. It takes first part of the URL to find out which area should be loaded (admin/frontend).
When the area is defined, configuration for that area is loaded (unlike Magento 1 where all configuration was loaded).
Then application object calls Magento\Framework\App\FrontControllerInterface::dispatch of requested area.
Step 6 :
Front Controller does routing same as in Magento 1. All routers are iterated to match request. The router that matches the request returns instance of ActionController. When FrontController gets instance of action controller it calls dispatch method on it. This process is more efficient because only routers of one area are used (admin router is not used in frontend).
Step 7 :
Action controller performs its task and returns instance of some implementation of ResultInterface.
Step 8 :
FrontController just returns ResultInterface to Application Instance that renders the response.
There is much more to Magento 2 than request flow. If you want dig deep, please find below a few useful links.
Magento 2 Useful Links
- Magento 2 Training: Fundamentals of Magento 2 Development
- Magento 2 Codebase: https://github.com/magento/magento2
- Magento 2 Documentation: http://devdocs.magento.com/
- Magento Forums: http://community.magento.com/t5/Core-Technology-Magento-2/ct-p/Magento-2
- Magento 2 Developer Hub: http://www.magento.com/developers/magento2
- See more at: http://magento.com/blog/technical/magento-2-merchant-beta-release#sthash.FpVsq4YF.dpuf