Skip to content

Documentation? #90

@adriansuter

Description

@adriansuter

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);.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions