<?php

/**
 * Dipper - A Lumen Architecture Project
 *
 * @package  Dipper
 * @author HollyTeng <n.haoyuan@gmail.com>
 */

$uri = urldecode(
    parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
);

// This file allows us to emulate Apache's "mod_rewrite" functionality from the
// built-in PHP web server. This provides a convenient way to test a Laravel
// application without having installed a "real" web server software here.
if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
    return false;
}

foreach (array(__DIR__ . '/public/index.php', __DIR__ . '/../../public/index.php', __DIR__ . '/../../../public/index.php') as $file) {
    if (file_exists($file)) {
        require_once $file;
        break;
    }
}
