-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathindex.php
More file actions
43 lines (34 loc) · 1.48 KB
/
Copy pathindex.php
File metadata and controls
43 lines (34 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
/**
* This file is part of the DebugPHP Server.
*
* (c) Leon Schmidt <kontakt@callmeleon.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @see https://github.com/CallMeLeon167/debugphp-server
*/
declare(strict_types=1);
// ─── Autoloader ──────────────────────────────────────────
$autoloader = __DIR__ . '/vendor/autoload.php';
if (!file_exists($autoloader)) {
$requestPath = parse_url($_SERVER['REQUEST_URI'] ?? '/', PHP_URL_PATH) ?: '/';
$base = rtrim(dirname($requestPath), '/');
header("Location: {$base}/setup/");
exit;
}
require_once $autoloader;
// ─── Check for .env ──────────────────────────────────────
if (!file_exists(__DIR__ . '/.env')) {
$requestPath = parse_url($_SERVER['REQUEST_URI'] ?? '/', PHP_URL_PATH) ?: '/';
$base = rtrim(dirname($requestPath), '/');
header("Location: {$base}/setup/");
exit;
}
// ─── Load environment variables ──────────────────────────
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv->load();
// ─── Run the application ─────────────────────────────────
use DebugPHP\Server\Application;
(new Application())->run();