Yii2 Request Lifecycle
Oct 29, 2015
Request Lifecycle
- make a request to entry script(index.php).
- entry script loads the app.config and creates an application instance to handle the request.
- app can resolve requested route by request components like urlmanager
- Then app will create a controller instance.
- controller creates an action instance and performs the filters for the action.
- If any filter fails, the action is cancelled.
- If all filters pass, the action is executed.
- action loads a data model from database.
- action renders a view, providing it with the data model.
- The rendered result is returned to the response application component.
- The response component sends the rendered result to the user’s browser.