public static function serve() { self::applyMiddleware(); $server = Injector::resolve("Server"); echo "<pre>"; print_r($server); echo "</pre>"; self::$engine->route("/" . implode("/", array_diff(explode("/", $_SERVER["REQUEST_URI"]), explode("/", $_SERVER["SCRIPT_NAME"])))); }
<?php use App\Router\Middleware\HTTPPathParser; use App\Router\Router; use App\Router\Engine; use App\Router\Injector\Injector; use App\Router\Injector\Server; Router::setEngine(new Engine()); Router::registerMiddleware("HTTPPathParser", new HTTPPathParser(), array("Server")); Injector::registerInjectable("Server", new Server());