I am using Zend Expressive as an API. I have succeeded adding a middleware, which validates the request headers of API Keys, for every single request.
At the moment I add the middleware using the pipe() function in config/pipeline.php
$app->pipe(new MyAuthMiddleware(....);
This actually works pretty well. However, I would like to add the piping using Zend Servicemanager instead, with a configuration file, like:
return [
'dependencies' => [
/* ... */
'invokables' => [
// Remove this entry:
App\Action\HelloAction::class => App\Action\HelloAction::class,
],
'factories' => [
/* ... */
// Add this:
App\Action\HelloAction::class => App\Action\HelloActionFactory::class,
],
/* ... */
],];
Question: Is it possible to pipe a middleware using Zend Servicemanager? And how if it is.