UrlRouter
class UrlRouter
Simple URL Routing for "Old school" PHP apps
This is a simple router if you want to write an old-style PHP application but with decent looking URLs. It provides a simple alternative to building a full up Silex application.
Based on RegexRouter from https://github.com/moagrius/RegexRouter
Improvements: - Add some "hot spots" {s} {d} - Make it so "/" is relative to cwd - Make it so the we add escapes and slashes to make the regex
Routing Rest URLs by pattern (Silex-Style)
$router = new Tsugi\Util\UrlRouter();
$router->route('/lessons/{s}$', function($id){
...
}
$router->execute();
Methods
route($pattern, $callback)
No description
static
cwd()
Gives the current folder of the executing script
execute($uri)
No description
trimQuery($uri = null)
No description
Details
at line 31
route($pattern, $callback)
at line 61
static
cwd()
Gives the current folder of the executing script
["SCRIPT_NAME"]=> string(21) "/wa4e/tsugi/route.php"
returns "/wa4e/tsugi" (no trailing slash)