Files
gtsit/app/bootstrap.php
2026-08-10 21:19:10 +09:00

40 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
spl_autoload_register(static function (string $class): void {
$prefix = 'App\\';
if (!str_starts_with($class, $prefix)) {
return;
}
$relative = str_replace('\\', DIRECTORY_SEPARATOR, substr($class, strlen($prefix)));
$path = __DIR__ . DIRECTORY_SEPARATOR . $relative . '.php';
if (is_file($path)) {
require $path;
}
});
require __DIR__ . '/Support/helpers.php';
date_default_timezone_set((string) config('app.timezone', 'Asia/Seoul'));
if (session_status() !== PHP_SESSION_ACTIVE) {
$secure = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off')
|| ($_SERVER['HTTP_X_FORWARDED_PROTO'] ?? '') === 'https';
session_name((string) config('app.session_name', 'gtsit_session'));
session_set_cookie_params([
'lifetime' => 0,
'path' => (string) (config('app.base_path', '') ?: '/'),
'secure' => $secure,
'httponly' => true,
'samesite' => 'Lax',
]);
session_start();
}
header('X-Content-Type-Options: nosniff');
header('Referrer-Policy: strict-origin-when-cross-origin');
header('Permissions-Policy: camera=(), microphone=(), geolocation=()');