When handling a user request, an application will undergo the following life cycle:
1. Pre-initialize the application with CApplication::preinit();
2. Set up the class autoloader and error handling;
3. Register core application components;
4. Load application configuration;
5. Initialize the application with CApplication::init()
• Register application behaviors;
• Load static application components;
6. Raise an onBeginRequest event;
7. Process the user request:
• Collect information about the request;
• Create a controller;
• Run the controller;
8. Raise an onEndRequest event;