HandlerStackConfigurator
class HandlerStackConfigurator (View source)
Defines a class for configuring middlewares on the http handler stack.
The http_client service requires a handler stack to perform http requests. This is provided by the http_handler_stack service. Modules wishing to add additional middlewares to the handler stack can create services and tag them as http_client_middleware. Each service must contain an __invoke method that returns a closure which will serve as the middleware.
Properties
| protected callable[] | $middlewares | Array of middlewares to add to the handler stack. |
|
| protected string[] | $middlewareIds | A list of used middleware service IDs. |
|
| protected ContainerInterface | $container | The service container. |
Methods
Constructs a new HandlerStackConfigurator object.
Ensures that the middlewares are initialized.
Configures the stack using services tagged as http_client_middleware.
Details
__construct(ContainerInterface $container, array $middleware_ids)
Constructs a new HandlerStackConfigurator object.
protected
initializeMiddlewares()
Ensures that the middlewares are initialized.
configure(HandlerStack $handler_stack)
Configures the stack using services tagged as http_client_middleware.