I've managed to use the request-handler combined with aura-router with a single router handler.
Am trying to implement route specific middleware, as opposed to the 'global' application middleware.
$routerContainer = new RouterContainer();
$map = $routerContainer->getMap();
// Works fine...
$map->get('index', '/', 'App\Http\Controllers\HomeController::index');
// Error: Invalid request handler: array
$map->get('index', '/', [
new SampleRouteMiddleware(),
'App\Http\Controllers\HomeController::index'
]);
$request = ServerRequestFactory::fromGlobals($_SERVER, $_GET, $_POST, $_COOKIE, $_FILES);
$requestContainer = new RequestHandlerContainer();
$dispatcher = new Dispatcher([
new SampleAppMiddleware(), // applies to all routes...
new AuraRouter($routerContainer),
new RequestHandler($requestContainer),
]);
$response = $dispatcher->dispatch($request);