On Friday, April 21, 2017 at 10:42:11 AM UTC-5, Rasmus Schultz wrote:
>
>
> $kernel = new NotFoundMiddleware();
> $kernel = new RouterMiddleware(new Router(...), $kernel);
> $kernel = new CacheMiddleware($kernel);
> $kernel = new ErrorHandlerMiddleware();
>
>
Off the top of my head, it feels like this would be difficult to 
automatically wire with a DI container since each middleware will need to 
be constructed with the previous middleware already instantiated. 
Especially given you cannot have consistent known arguments, this will be 
difficult to automate.

return $this->container->get($id)->process($request);


I think you tried to address this with the ContainerProxyMiddleware but it 
skips the construction part. How would the container know which $kernel to 
use in the constructor for the object at $id? This looks nice, API-wise, 
but it is ignoring how this object would actually be constructed.

One of the things we did with Stack was required the first argument to 
always be the kernel and any additional arguments (if any at all) would 
have to follow after that. We used Stack Builder to help try and solve 
those problems. It still seemed messy and I was never very happy with it.

-- 
You received this message because you are subscribed to the Google Groups "PHP 
Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to php-fig+unsubscr...@googlegroups.com.
To post to this group, send email to php-fig@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/php-fig/99e602d1-e871-4d19-829a-1330252b508c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to