Runtime Assembly
[!NOTE] The repository declares a front-controller chain from
index.phpinto CodeIgniter and a controller-to-response lifecycle. This documents source wiring only: deployment reachability, an actual request run, and successful execution were not observed.
Front-controller bootstrap
The declared top-level order in index.php is:
1. Set the initial response and resource limits | Emit the no-cache response headers, set the time limit to 500 seconds, and set the memory limit to 2G.
2. Check the PHP version | Compare **phpversion()** with the minimum value '7.2'; the source-declared **die()** branch reports an error when the comparison is below the minimum.
3. Establish the front-controller paths | Define **FCPATH** from **__DIR__** and compute **$pathsPath** as the application Paths.php location.
4. Load path configuration | Change the working directory to **__DIR__**, then require **$pathsPath**.
5. Construct and bootstrap the application | Instantiate **Config\\Paths**, require the framework bootstrap from **$paths->systemDirectory**, and `require_once 'excel_reader2.php'`.
6. Launch the application | Declare the direct `$app->run();` call as the application launch point.
The framework’s initialize() implementation calls bootstrapEnvironment(). That method requires the environment-specific boot file when APPPATH . 'Config/Boot/' . ENVIRONMENT . '.php' exists. The missing-file branch is shown under Execution boundaries.
Declared request lifecycle
flowchart TD
fc["index.php"] --> launch["$app->run()"]
launch --> run["CodeIgniter::run()"]
run --> setup["request and response setup"]
setup --> secure["forceSecureAccess()"]
secure --> spoof["spoofRequestMethod()"]
spoof --> pre["pre_system event"]
pre --> cache{"displayCache() returns ResponseInterface?"}
cache -->|cached and returnResponse true| cachedReturn["return cached response"]
cache -->|cached and returnResponse false| cachedSend["send cached response; exit"]
cache -->|no cached response| handler["handleRequest()"]
handler --> route["tryToRouteIt()"]
route --> router["router->handle(path)"]
router --> selected["selected controller and method"]
selected --> before{"before filters when SPARKED is not defined?"}
before -->|SPARKED defined: bypass| start["startController()"]
before -->|no response: continue| start
before -->|RedirectResponse or ResponseInterface| early["send returned response; return"]
start --> callable{"controller callable?"}
callable -->|no| create["createController()"]
callable -->|yes| gather["gatherOutput()"]
create --> dispatch["runController()"]
dispatch --> gather
gather --> after{"after filters when SPARKED is not defined?"}
after -->|SPARKED defined: bypass| previous["store previous URL"]
after -->|SPARKED not defined: run after filters| previous
previous --> responseMode{"returnResponse?"}
responseMode -->|false| send["sendResponse()"]
responseMode -->|true| noSend["do not send"]
send --> post["post_system event; return response"]
noSend --> post
Setup and cache
run() starts benchmarking, obtains the request and response objects, applies secure-access handling and request-method spoofing, triggers pre_system, and then checks the page cache. A cached response either returns directly when returnResponse is true or is sent before the exit path when it is false. Without a cached response, run() enters handleRequest().
Routing and filter gate
tryToRouteIt() requires Routes.php when empty($routes) || ! $routes instanceof RouteCollectionInterface, passes the determined path to the router, records the selected controller and method, and returns the router-provided route filter. Route definitions and detailed filter policy belong to the Routes and Filters page.
handleRequest() enables a returned route filter for both phases. When SPARKED is defined, the source bypasses both filter execution blocks. Otherwise, a before filter can return a RedirectResponse or another ResponseInterface, which sends and returns before controller dispatch.
Controller dispatch
After the before-filter gate continues, startController() runs. A non-callable controller is created, the post_controller_constructor event is triggered, and runController() is called. A callable controller follows the callable branch instead of that creation-and-dispatch sequence.
Response completion
After controller output, handleRequest() gathers the output. It runs after filters only when SPARKED is not defined, stores the previous URL, conditionally calls sendResponse() only when returnResponse is false, triggers post_system, and returns the response object.
Exception exits
run() catches RedirectException by building and sending a redirect from the exception message, then exiting successfully. It catches PageNotFoundException through display404errors().
Controller initialization and the shared Component example
[
{
"title": "Base controller initialization",
"body": "CodeIgniter::createController() hands a created controller to initController(). The base Controller implementation binds the request, response, and logger, logs that the controller was loaded, optionally applies forceHTTPS when forceHTTPS is greater than zero, and calls loadHelpers()."
},
{
"title": "Shared Component view method",
"body": "The shared Component Common controller extends the framework Controller. Its view($type,$mainID=false) method decodes mainID with the controller hash when a value is supplied, stores type in data['type'], and builds the common type-specific include path. When that index.php file exists, the method includes it. It then requires the corresponding view file to exist; otherwise it throws PageNotFoundException. The method constructs the Project include common type view name and returns view($v,$data)."
}
]
Execution boundaries
[!WARNING]
- The
REMOTE_ADDRmaintenance condition at the start ofindex.php, itsmaintenance.htmlinclude, and its exit are commented out. They are not an active request gate.- If the environment-specific boot file is missing, bootstrapEnvironment() declares an HTTP 503 response, prints
The application environment is not set correctly., and exits with status1.- Before and after filters run only when
SPARKEDis not defined. A before filter can return aRedirectResponseor anotherResponseInterface; either result is sent and returns before the controller path. Therefore controller dispatch is not unconditional in the declared lifecycle.
Updated