Documentation

ValidationMiddleware
in package
implements MiddlewareInterface

Interfaces, Classes and Traits

MiddlewareInterface

Table of Contents

$container  : Container
The middleware needs access to the container, so that we can interact with other components of the system appropriately.
$response  : RequestHandlerInterface|null
$rules  : Collection<string|int, ValidationRule>
__construct()  : mixed
after()  : mixed
before()  : mixed
process()  : ResponseInterface
Handle the request, performing validation.

Properties

$container

The middleware needs access to the container, so that we can interact with other components of the system appropriately.

private Container $container

Methods

__construct()

public __construct(Container $container, Collection $rules, RequestHandlerInterface|null $errorpage) : mixed
Parameters
$container : Container
$rules : Collection
$errorpage : RequestHandlerInterface|null
Return values
mixed

after()

public after(ContextInterface $context[, Response $response = null ]) : mixed
Parameters
$context : ContextInterface
$response : Response = null
Tags
deprecated
todo

Remove

Return values
mixed

before()

public before(ContextInterface $context) : mixed
Parameters
$context : ContextInterface
Tags
deprecated
todo

Remove

Return values
mixed

process()

Handle the request, performing validation.

public process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface
Parameters
$request : ServerRequestInterface
$handler : RequestHandlerInterface
Tags
todo

If the validation fails, the information should be injected into view, so the application can use it

todo

Introduce a class that maintains the list of validation errors so controllers can locate them

Return values
ResponseInterface

Search results