Update: 2026-05-03 20:56:55

This commit is contained in:
Hamza-Ayed
2026-05-03 20:56:55 +03:00
parent 8af74f0621
commit b33513ebcf
3 changed files with 28 additions and 18 deletions

View File

@@ -1,11 +1,20 @@
<?php
/**
* Simple Bootstrap Initialization
* Application Bootstrap Initialization
*/
declare(strict_types=1);
// 1. Error Reporting (Secure for production)
// 1. Basic Constants
define('ROOT_PATH', dirname(__DIR__, 2));
define('APP_PATH', ROOT_PATH . '/app');
define('STORAGE_PATH', ROOT_PATH . '/storage');
// 2. Load Environment Loader & Helpers FIRST
require_once APP_PATH . '/bootstrap/env.php';
require_once APP_PATH . '/helpers/helpers.php';
// 3. Error Reporting (Secure for production - Now we can use env())
if (env('APP_DEBUG', 'false') === 'true') {
error_reporting(E_ALL);
ini_set('display_errors', '1');
@@ -14,24 +23,13 @@ if (env('APP_DEBUG', 'false') === 'true') {
ini_set('display_errors', '0');
}
// 2. Security Headers
// 4. Security Headers
header("X-Content-Type-Options: nosniff");
header("X-Frame-Options: DENY");
header("X-XSS-Protection: 1; mode=block");
header("Referrer-Policy: strict-origin-when-cross-origin");
// 3. Constants
define('ROOT_PATH', dirname(__DIR__, 2));
define('APP_PATH', ROOT_PATH . '/app');
define('STORAGE_PATH', ROOT_PATH . '/storage');
// 3. Environment Loader
require_once APP_PATH . '/bootstrap/env.php';
// 3. Common Helpers
require_once APP_PATH . '/helpers/helpers.php';
// 4. Core Classes (Manual autoload for simplicity)
// 5. Intelligent Autoloader (Case-Insensitive for directories)
spl_autoload_register(function ($class) {
$prefix = 'App\\';
$base_dir = APP_PATH . '/';
@@ -53,8 +51,8 @@ spl_autoload_register(function ($class) {
}
});
// 5. Response Utility
// 6. Response Utility
require_once APP_PATH . '/bootstrap/response.php';
// 6. Auth Session/State (Simple)
// 7. Global Auth Helper
require_once APP_PATH . '/bootstrap/auth.php';