-
Notifications
You must be signed in to change notification settings - Fork 45
Open
Description
Unfortunately I have not found a documentation nor any best-practices on how to use this library with slim 4. The README explains the instantiation process only.
In a test installation I used it in the route callable (an invokable class) the following way - is that correct?
// .... strict types and namespace
use Slim\Http\Response;
use Slim\Http\ServerRequest;
class HomeController
{
public function __invoke(ServerRequest $request, Response $response, array $args = []): Response
{
return $response->withJson(['foo' => 'bar']);
}
}Am I loosing anything by directly typehinting Slim\Http\ServerRequest and Slim\Http\Response for the first two params?
The documentarion should mention that after installation (which works out-of-the-box), the first two arguments of the route callables would be decorated. I assume the same holds for the middleware $request param and for $response in the middleware code $response = $handler->handle($request);.
slokhorst, piotr-cz, j13k, esetnik and AlexSWall
Metadata
Metadata
Assignees
Labels
No labels