1.4 KiB
1.4 KiB
Request Flow
Every application follows the same flow:
- Application starts from
index.php
.- The application, module, and system paths are set. (
APPPATH
,MODPATH
, andSYSPATH
) - Error reporting levels are set.
- Install file is loaded, if it exists.
- The [Kohana] class is loaded.
- The bootstrap file,
APPPATH/bootstrap.php
, is included.
- The application, module, and system paths are set. (
- Once we are in
bootstrap.php
: 7. [Kohana::init] is called, which sets up error handling, caching, and logging. 8. [Kohana_Config] readers and [Kohana_Log] writers are attached. 9. [Kohana::modules] is called to enable additional modules. * Module paths are added to the cascading filesystem. * Includes each module'sinit.php
file, if it exists. * Theinit.php
file can perform additional environment setup, including adding routes. 10. [Route::set] is called multiple times to define the application routes. 11. [Request::instance] is called to start processing the request. 1. Checks each route that has been set until a match is found. 2. Creates the controller instance and passes the request to it. 3. Calls the [Controller::before] method. 4. Calls the controller action, which generates the request response. 5. Calls the [Controller::after] method. * The above 5 steps can be repeated multiple times when using HMVC sub-requests. - Application flow returns to index.php 12. The main [Request] response is displayed