class FileRouter

Super Simple File Based Router

This router routes paths like .../install to .../install.php if the file exists.

$router = new Tsugi\Util\FileRouter();
$file = $router->fileCheck();
if ( $file ) {
    require_once($file);
    return;
}

This pattern uses GET parameters rather than REST parameters but a single route is all that is needed to route requests to a file. You should use one or the other but not both to keep things simple.

Methods

static 
cwd()

Gives the current folder of the executing script

trimQuery($uri)

No description

fileCheck($uri = null)

No description

Details

at line 31
static cwd()

Gives the current folder of the executing script

["SCRIPT_NAME"]=> string(21) "/wa4e/tsugi/route.php"

returns "/wa4e/tsugi" (no trailing slash)

at line 35
trimQuery($uri)

Parameters

$uri

at line 42
fileCheck($uri = null)

Parameters

$uri