onfig = [‘settings’ => [
‘determineRouteBeforeAppMiddleware’ => true,
‘displayErrorDetails’ => true,
]];
$app = new \Slim\App($config);
// Fetch DI Container
$container = $app->getContainer();
//print_r($container);
//print_r($views);
// Instantiate and add Slim specific extension
/*
$mw = function ($request, $response, $next) {
//$response->write(‘hello’);
$route = $request->getAttribute(‘route’);
$arg = $route->getArguments();
$body = $response->getBody()->write(‘hello’);
$a = $request->getQueryparams();
echo $foo = $request->getAttribute(‘email’);
print_r($foo);
$response = $next($request, $response);
//$response->getBody()->write();
//$response = $args['email'];
return $response;
};
*/
//$app->group(’/’,function() use($app){
$app->get('/getmail/{email}',function ($request, $response, $args){
//$obj = new ps;
echo $args[‘email’];
$status = $response->getStatusCode();
return $response;
})->add(new middleware\guestMiddleware(“hello”));
/*
->add(function ($request, $response, $next) {
$id = $request->getAttribute(‘route’)->getArgument(‘email’);
return $next($request, $response);
});
//});
*/
$app->run();