Download the PHP package ellipse/handlers-container without Composer
On this page you can find all versions of the php package ellipse/handlers-container. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ellipse/handlers-container
More information about ellipse/handlers-container
Files in ellipse/handlers-container
Package handlers-container
Short Description Psr-15 request handler proxying a Psr-11 container entry
License MIT
Homepage https://github.com/ellipsephp/handlers-container
Informations about the package handlers-container
Request handler container
This package provides a Psr-15 request handler proxying a Psr-11 container entry.
Require php >= 7.0
Installation composer require ellipse/handlers-container
Run tests ./vendor/bin/kahlan
- Using container entries as request handlers
- Example using auto wiring
Using container entries as request handlers
The class Ellipse\Handlers\ContainerRequestHandler
takes an implementation of Psr\Container\ContainerInterface
and a container id as parameters. Its ->handle()
method retrieve a request handler from the container using this id and proxy its ->handle()
method.
It can be useful in situations the container entry should be resolved at the time the request is handled.
An Ellipse\Handlers\Exceptions\ContainedRequestHandlerTypeException
is thrown when the value retrieved from the container is not an object implementing Psr\Http\Server\RequestHandlerInterface
.
Example using auto wiring
It can be cumbersome to register every request handler classes in the container. Here is how to auto wire request handler instances using the Ellipse\Container\ReflectionContainer
class from the ellipse/container-reflection package.
All versions of handlers-container with dependencies
psr/http-message Version ^1.0
psr/http-server-handler Version ^1.0
psr/http-server-middleware Version ^1.0
psr/container Version ^1.0
ellipse/type-errors Version ^1.0