Magento 2 magento application initialization, magento request flow, magento2

Magento Application Initialization

Step 1: index.php calls at the first inside magento root direcotry.

Step 2: index.php first include bootstrap.php inside app/ folder to initialize the error reporting and other checks.

Step 3: index.php calls static method create() of bootstrap class(\Magento\Framework\App\Bootstrap) to create objectmanagerfactory and bootstrap objects.

Step 4: 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 5: index.php calls run() method of bootstrap object to run the application, which in turn will call launch() method of application object(\Magento\Framework\App\Http).

Step 6: 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.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.

Step 6.2: Action controller performs its task and returns instance of some implementation of ResultInterface.

Step 6.3: FrontController just returns ResultInterface to Application Instance that renders the response.

There is more about Magento request flow process.

magento application initilazation

Reference –

Leave a Reply

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