master

laravel/framework

Last updated at: 29/12/2023 09:23

server.php

TLDR

This file is used to emulate Apache's "mod_rewrite" functionality from the built-in PHP web server. It allows testing a Laravel application without installing a "real" web server software.

Methods

None

Classes

None

<?php

$publicPath = getcwd();

$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($publicPath.$uri)) {
    return false;
}

require_once $publicPath.'/index.php';