<?php

/**
 * CodeIgniter Post-Installation Logic
 * --------------------------------------------------------------------
 *
 * This file is the entry point for your application.
 */


$minPHPVersion = '7.4';
if (phpversion() < $minPHPVersion) {
    die("Your PHP version must be {$minPHPVersion} or higher to run CodeIgniter. Current version: " . phpversion());
}
unset($minPHPVersion);

// Path to the front controller (this file)
define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR);

// Ensure the current directory is pointing to the front controller's directory
chdir(FCPATH);

/*
 *---------------------------------------------------------------
 * BOOTSTRAP THE APPLICATION
 *---------------------------------------------------------------
 * This process sets up the path constants, loads vendors,
 * and boots the framework or any other core library.
 */

$pathsConfig = FCPATH . 'app/Config/Paths.php';
// Check if the paths config file exists
if (! file_exists($pathsConfig)) {
    die('The paths config file could not be found. Please check your installation.');
}

require realpath($pathsConfig) ?: $pathsConfig;

$paths = new Config\Paths();

// Load the framework bootstrap file.
$bootstrap = rtrim($paths->systemDirectory, '\\/ ') . DIRECTORY_SEPARATOR . 'bootstrap.php';
$app       = require realpath($bootstrap) ?: $bootstrap;

/*
 *---------------------------------------------------------------
 * LAUNCH THE APPLICATION
 *---------------------------------------------------------------
 * Now that everything is setup, it's time to actually run
 * the application and send the response back to the client.
 */

$app->run();
