PHP Class GuzzleHttp\Client

Inheritance: implements guzzlehttp\ClientInterface, use trait GuzzleHttp\Event\HasEmitterTrait
显示文件 Open project: nystudio107/instantanalytics Class Usage Examples

Public Methods

Method Description
__call ( $method, $args )
__construct ( array $config = [] ) Clients accept an array of constructor parameters.
getConfig ( $option = null )
request ( $method, $uri = '', array $options = [] )
requestAsync ( $method, $uri = '', array $options = [] )
send ( Psr\Http\Message\RequestInterface $request, array $options = [] )
sendAsync ( Psr\Http\Message\RequestInterface $request, array $options = [] )

Private Methods

Method Description
applyOptions ( Psr\Http\Message\RequestInterface $request, array &$options ) : Psr\Http\Message\RequestInterface Applies the array of request options to a request.
buildUri ( $uri, array $config )
configureDefaults ( array $config ) Configures the default options for a client.
invalidBody ( )
prepareDefaults ( array $options ) : array Merges default options into the array.
transfer ( Psr\Http\Message\RequestInterface $request, array $options ) : GuzzleHttp\Promise\PromiseInterface Transfers the given request and applies request options.

Method Details

__call() public method

public __call ( $method, $args )

__construct() public method

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 also: GuzzleHttp\RequestOptions for a list of available request options.
public __construct ( array $config = [] )
$config array Client configuration settings.

getConfig() public method

public getConfig ( $option = null )

request() public method

public request ( $method, $uri = '', array $options = [] )
$options array

requestAsync() public method

public requestAsync ( $method, $uri = '', array $options = [] )
$options array

send() public method

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

sendAsync() public method

public sendAsync ( Psr\Http\Message\RequestInterface $request, array $options = [] )
$request Psr\Http\Message\RequestInterface
$options array