I’m trying to migrate a legacy app from Laminas v1 to v3 (as part of a PHP 8.1 upgrade).
I’ve got the bare bones of the existing middleware working by wrapping it up in DoublePassMiddlewareDecorator
e.g.
$app = new Laminas\Stratigility\MiddlewarePipe();
$app->pipe(new DoublePassMiddlewareDecorator($services->get(Middleware\AuthenticationMiddleware::class)));
I’m having trouble with the NotFoundHandler
and the ErrorHandler
. The v3 Stratigiligy docs (Error Handlers - laminas-stratigility - Laminas Docs) seem to be out-of-date.
$app->pipe(new ErrorHandler(new Response(), new ErrorResponseGenerator($isDevelopmentMode));
...
$app->pipe(new NotFoundHandler(new Response());
I think I’ve got the error handler working by providing a closure that simply returns a new Response()
, but I’m not sure how to plug the Laminas\Stratigility\Handler\NotFoundHandler
into the MiddlewarePipe
, since it doesn’t support MiddlewareInterface
.
Is there a way to use a NotFoundHandler
with a MiddlewarePipe
, or do I need to create a custom NotFoundMiddleware
that implements the interface?