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 BootPHP class is loaded.
- BootPHP::init is called, which sets up error handling, caching, and logging.
- BootPHP_Config readers and BootPHP_Log writers are attached.
- BootPHP::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::instance 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