<?php
// Built-in PHP webserver router
$uri = urldecode(parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH));

// Serve static files directly
$publicDir = __DIR__;
$file = $publicDir . $uri;
if ($uri !== '/' && file_exists($file) && !is_dir($file)) {
    return false;
}

// Otherwise, hand off to Laravel
$_SERVER["SCRIPT_NAME"] = '/index.php';
$_SERVER["SCRIPT_FILENAME"] = $publicDir . '/index.php';
require $publicDir . '/index.php';
