The Middleware Container
While the skeleton creates a general PSR-11 container in which to map all of your dependencies, this can pose problems when you are attempting to pull middleware and request handlers; you could potentially, accidentally, pull something of a different type entirely, which may not work in either context!
To prevent this from happening, we provide
Zend\Expressive\MiddlewareContainer. It decorates your application container,
and adds the following behavior:
trueif a service does not exist in the container, but is a class that exists.
- will instantiate a class directly if the service does not exist, but is a class that exists.
- decorate PSR-15
- raise an exception if the instance to return is not a PSR-15
Internally, this class is used by the MiddlewareFactory
Zend\Expressive\Middleware\LazyLoadingMiddleware class; you should
never need to interact with it directly, unless the above features are of
interest to you.
Found a mistake or want to contribute to the documentation? Edit this page on GitHub!