Yii2 Request Lifecycle

Yii2 Request Lifecycle

The following diagram describe how an application handles a request and response. You are also requested to scroll down to read the step..

  1. A user makes a request to the entry script web/index.php.
  2. The entry script loads the application configuration and creates an application instance to handle the request.
  3. The application resolves the requested route with the help of the request application component.
  4. The application creates a controller instance to handle the request.
  5. The controller creates an action instance and performs the filters for the action.
  6. If any filter fails, the action is cancelled.
  7. If all filters pass, the action is executed.
  8. The action loads a data model, possibly from a database.
  9. The action renders a view, providing it with the data model.
  10. The rendered result is returned to the response application component.
  11. The response component sends the rendered result to the user’s browser.

Share this post

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.