Creates a composed Guzzle handler function by stacking middlewares on top of an HTTP handler function.

CloneableInstantiable
Methods
public __construct(?callable $handler = NULL)
 


    public __invoke(Psr\Http\Message\RequestInterface $request, array $options)
     
    Invokes the handler stack as a composed handler

    • return ResponseInterface|\PromiseInterface
    public __toString()
     
    Dumps a string representation of the stack.

    • return string
    public after( $findName, callable $middleware, $withName = '')
     
    Add a middleware after another middleware by name.

      public before( $findName, callable $middleware, $withName = '')
       
      Add a middleware before another middleware by name.

        public static create(?callable $handler = NULL)
         
        Creates a default handler stack that can be used by clients.

        The returned handler will wrap the provided handler or use the most
        appropriate default handler for your system. The returned HandlerStack has
        support for cookies, redirects, HTTP error exceptions, and preparing a body
        before sending.

        The returned handler stack can be passed to a client in the "handler"
        option.

        public hasHandler()
         
        Returns true if the builder has a handler.

        • return bool
        public push(callable $middleware, $name = '')
         
        Push a middleware to the top of the stack.

          public remove( $remove)
           
          Remove a middleware by instance or name from the stack.

            public resolve()
             
            Compose the middleware and handler into a single callable function.

            • return callable
            public setHandler(callable $handler)
             
            Set the HTTP handler that actually returns a promise.

              public unshift(callable $middleware, $name = NULL)
               
              Unshift a middleware to the bottom of the stack.

                Properties
                private $cached
                 


                • var callable|null
                private $handler
                 


                • var callable|null
                private $stack
                 


                • var array
                Methods
                private debugCallable( $fn)
                 
                Provides a debug string for a given callable.

                • return string
                private findByName( $name)
                 


                • return int
                private splice( $findName, $withName, callable $middleware, $before)
                 
                Splices a function into the middleware list at a specific position.

                  Methods
                  public static create(?callable $handler = NULL)
                   
                  Creates a default handler stack that can be used by clients.

                  The returned handler will wrap the provided handler or use the most
                  appropriate default handler for your system. The returned HandlerStack has
                  support for cookies, redirects, HTTP error exceptions, and preparing a body
                  before sending.

                  The returned handler stack can be passed to a client in the "handler"
                  option.

                  © 2020 Bruce Wells
                  Search Namespaces \ Classes
                  ConfigurationNumbers (0-9.) only