Request Flow
Every application follows the same flow:
- Application starts from
index.php
.
- The application, module, and system paths are set. (
APPPATH
, MODPATH
, and SYSPATH
)
- Error reporting levels are set.
- Install file is loaded, if it exists.
- The bootstrap file,
APPPATH/bootstrap.php
, is included.
- Once we are in
bootstrap.php
:
- The Kohana class is loaded.
- Kohana::init is called, which sets up error handling, caching, and logging.
- Kohana_Config readers and Kohana_Log writers are attached.
- Kohana::modules is called to enable additional modules.
- Module paths are added to the cascading filesystem.
- Includes each module's
init.php
file, if it exists.
- The
init.php
file can perform additional environment setup, including adding routes.
- Route::set is called multiple times to define the application routes.
- Request::factory is called to start processing the request.
- Checks each route that has been set until a match is found.
- Creates the controller instance and passes the request to it.
- Calls the Controller::before method.
- Calls the controller action, which generates the request response.
- Calls the Controller::after method.
- Application flow returns to index.php
- The main Request response is displayed