CloneableInstantiable
    ImplementsGuzzleHttp\ClientInterface
    Constants
    public GuzzleHttp\ClientInterface::VERSION = '6.5.1'
     


    • deprecated Will be removed in Guzzle 7.0.0
    Methods
    public __call( $method, $args)
    public __construct(array $config = [])
     
    Clients accept an array of constructor parameters.

    Here's an example of creating a client using a base_uri and an array of
    default request options to apply to each request:

    $client = new Client([
        'base_uri'        => 'http://www.foo.com/1.0/',
        'timeout'         => 0,
        'allow_redirects' => false,
        'proxy'           => '192.168.16.1:10'
    ]);
    

    Client configuration settings include the following options:

    • handler: (callable) Function that transfers HTTP requests over the
      wire. The function is called with a Psr7\Http\Message\RequestInterface
      and array of transfer options, and must return a
      GuzzleHttp\Promise\PromiseInterface that is fulfilled with a
      Psr7\Http\Message\ResponseInterface on success. "handler" is a
      constructor only option that cannot be overridden in per/request
      options. If no handler is provided, a default handler will be created
      that enables all of the request options below by attaching all of the
      default middleware to the handler.
    • base_uri: (string|UriInterface) Base URI of the client that is merged
      into relative URIs. Can be a string or instance of UriInterface.
    • **: any request option
    • see \GuzzleHttp\RequestOptionsfor a list of available request options.
    public getConfig( $option = NULL)
     
    Get a client configuration option.

    These options include default request options of the client, a "handler"
    (if utilized by the concrete client), and a "base_uri" if utilized by
    the concrete client.

    • return mixed
    public request( $method, $uri = '', array $options = [])
     
    Create and send an HTTP request.

    Use an absolute path to override the base path of the client, or a
    relative path to append to the base path of the client. The URL can
    contain the query string as well.

    • return ResponseInterface
    • throws GuzzleException
    public requestAsync( $method, $uri = '', array $options = [])
     
    Create and send an asynchronous HTTP request.

    Use an absolute path to override the base path of the client, or a
    relative path to append to the base path of the client. The URL can
    contain the query string as well. Use an array to provide a URL
    template and additional variables to use in the URL template expansion.

    public send(Psr\Http\Message\RequestInterface $request, array $options = [])
     
    Send an HTTP request.

    • return ResponseInterface
    • throws GuzzleException
    public sendAsync(Psr\Http\Message\RequestInterface $request, array $options = [])
     
    Asynchronously send an HTTP request.

    Properties
    private $config
     


    • var array Default request options
    Methods
    private applyOptions(Psr\Http\Message\RequestInterface $request, array $options)
     
    Applies the array of request options to a request.

    • return RequestInterface
    private buildUri( $uri, array $config)
     


    • return UriInterface
    private configureDefaults(array $config)
     
    Configures the default options for a client.

    • return void
    private invalidBody()
     
    Throw Exception with pre-set message.

    • return void
    • throws InvalidArgumentException Invalid body.
    private prepareDefaults(array $options)
     
    Merges default options into the array.

    • return array
    private transfer(Psr\Http\Message\RequestInterface $request, array $options)
     
    Transfers the given request and applies request options.

    The URI of the request is not modified and the request options are used
    as-is without merging in default options.

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