\GuzzleHttp

Namespaces

Cookie
Exception
Handler
Promise
Psr7

Interfaces

ClientInterface Client interface for sending HTTP requests.

Classes

Client
HandlerStack Creates a composed Guzzle handler function by stacking middlewares on top of an HTTP handler function.
MessageFormatter Formats log messages using variable substitutions for requests, responses, and other transactional data.
Middleware Functions used to create and wrap handlers with handler middleware.
Pool Sends an iterator of requests concurrently using a capped pool size.
PrepareBodyMiddleware Prepares requests that contain a body, adding the Content-Length, Content-Type, and Expect headers.
RedirectMiddleware Request redirect middleware.
RequestOptions This class contains a list of built-in Guzzle request options.
RetryMiddleware Middleware that retries requests based on the boolean result of invoking the provided "decider" function.
TransferStats Represents data at the point after it was transferred either successfully or after a network error.
UriTemplate Expands URI templates. Userland implementation of PECL uri_template.

Functions

choose_handler()

choose_handler() : callable

Chooses and creates a default handler to use based on the environment.

The returned handler is not wrapped by any default middlewares.

Throws

\RuntimeException

if no viable Handler is available.

Returns

callable —

Returns the best handler for the given system.

debug_resource()

debug_resource(mixed  $value = null) : resource

Returns a debug stream based on the provided variable.

Parameters

mixed $value

Optional value

Returns

resource

default_ca_bundle()

default_ca_bundle() : string

Returns the default cacert bundle for the current system.

First, the openssl.cafile and curl.cainfo php.ini settings are checked. If those settings are not configured, then the common locations for bundles found on Red Hat, CentOS, Fedora, Ubuntu, Debian, FreeBSD, OS X and Windows are checked. If any of these file locations are found on disk, they will be utilized.

Note: the result of this function is cached for subsequent calls.

Throws

\RuntimeException

if no bundle can be found.

Returns

string

default_user_agent()

default_user_agent() : string

Get the default User-Agent string to use with Guzzle

Returns

string

describe_type()

describe_type(mixed  $input) : string

Debug function used to describe the provided value type and class.

Parameters

mixed $input

Returns

string —

Returns a string containing the type of the variable and if a class is provided, the class name.

headers_from_lines()

headers_from_lines(array  $lines) : array

Parses an array of header lines into an associative array of headers.

Parameters

array $lines

Header lines array of strings in the following format: "Name: Value"

Returns

array

is_host_in_noproxy()

is_host_in_noproxy(string  $host, array  $noProxyArray) : boolean

Returns true if the provided host matches any of the no proxy areas.

This method will strip a port from the host if it is present. Each pattern can be matched with an exact match (e.g., "foo.com" == "foo.com") or a partial match: (e.g., "foo.com" == "baz.foo.com" and ".foo.com" == "baz.foo.com", but ".foo.com" != "foo.com").

Areas are matched in the following cases:

  1. "*" (without quotes) always matches any hosts.
  2. An exact match.
  3. The area starts with "." and the area is the last part of the host. e.g. '.mit.edu' will match any host that ends with '.mit.edu'.

Parameters

string $host

Host to check against the patterns.

array $noProxyArray

An array of host patterns.

Returns

boolean

json_decode()

json_decode(string  $json, boolean  $assoc = false, integer  $depth = 512, integer  $options) : mixed

Wrapper for json_decode that throws when an error occurs.

Parameters

string $json

JSON data to parse

boolean $assoc

When true, returned objects will be converted into associative arrays.

integer $depth

User specified recursion depth.

integer $options

Bitmask of JSON decode options.

Throws

\GuzzleHttp\Exception\InvalidArgumentException

if the JSON cannot be decoded.

Returns

mixed

json_encode()

json_encode(mixed  $value, integer  $options, integer  $depth = 512) : string

Wrapper for JSON encoding that throws when an error occurs.

Parameters

mixed $value

The value being encoded

integer $options

JSON encode option bitmask

integer $depth

Set the maximum depth. Must be greater than zero.

Throws

\GuzzleHttp\Exception\InvalidArgumentException

if the JSON cannot be encoded.

Returns

string

normalize_header_keys()

normalize_header_keys(array  $headers) : array

Creates an associative array of lowercase header names to the actual header casing.

Parameters

array $headers

Returns

array

uri_template()

uri_template(string  $template, array  $variables) : string

Expands a URI template

Parameters

string $template

URI template

array $variables

Template variables

Returns

string