Documentation

functions.php

Table of Contents

Functions

describe_type()  : string
Debug function used to describe the provided value type and class.
headers_from_lines()  : array<string|int, mixed>
Parses an array of header lines into an associative array of headers.
debug_resource()  : resource
Returns a debug stream based on the provided variable.
choose_handler()  : callable(RequestInterface, array<string|int, mixed>): PromiseInterface
Chooses and creates a default handler to use based on the environment.
default_user_agent()  : string
Get the default User-Agent string to use with Guzzle.
default_ca_bundle()  : string
Returns the default cacert bundle for the current system.
normalize_header_keys()  : array<string|int, mixed>
Creates an associative array of lowercase header names to the actual header casing.
is_host_in_noproxy()  : bool
Returns true if the provided host matches any of the no proxy areas.
json_decode()  : object|array<string|int, mixed>|string|int|float|bool|null
Wrapper for json_decode that throws when an error occurs.
json_encode()  : string
Wrapper for JSON encoding that throws when an error occurs.

Functions

describe_type()

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

describe_type will be removed in guzzlehttp/guzzle:8.0. Use Utils::describeType instead.

describe_type(mixed $input) : string
Parameters
$input : mixed

Any type of variable to describe the type of. This parameter misses a typehint because of that.

Return values
string

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

headers_from_lines()

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

headers_from_lines will be removed in guzzlehttp/guzzle:8.0. Use Utils::headersFromLines instead.

headers_from_lines(iterable<string|int, mixed> $lines) : array<string|int, mixed>
Parameters
$lines : iterable<string|int, mixed>

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

Return values
array<string|int, mixed>

debug_resource()

Returns a debug stream based on the provided variable.

debug_resource will be removed in guzzlehttp/guzzle:8.0. Use Utils::debugResource instead.

debug_resource([mixed $value = null ]) : resource
Parameters
$value : mixed = null

Optional value

Return values
resource

choose_handler()

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

choose_handler will be removed in guzzlehttp/guzzle:8.0. Use Utils::chooseHandler instead.

choose_handler() : callable(RequestInterface, array<string|int, mixed>): PromiseInterface

The returned handler is not wrapped by any default middlewares.

Tags
throws
RuntimeException

if no viable Handler is available.

Return values
callable(RequestInterface, array<string|int, mixed>): PromiseInterface

Returns the best handler for the given system.

default_user_agent()

Get the default User-Agent string to use with Guzzle.

default_user_agent will be removed in guzzlehttp/guzzle:8.0. Use Utils::defaultUserAgent instead.

default_user_agent() : string
Return values
string

default_ca_bundle()

Returns the default cacert bundle for the current system.

default_ca_bundle will be removed in guzzlehttp/guzzle:8.0. This function is not needed in PHP 5.6+.

default_ca_bundle() : string

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.

Tags
throws
RuntimeException

if no bundle can be found.

Return values
string

normalize_header_keys()

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

normalize_header_keys will be removed in guzzlehttp/guzzle:8.0. Use Utils::normalizeHeaderKeys instead.

normalize_header_keys(array<string|int, mixed> $headers) : array<string|int, mixed>
Parameters
$headers : array<string|int, mixed>
Return values
array<string|int, mixed>

is_host_in_noproxy()

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

is_host_in_noproxy will be removed in guzzlehttp/guzzle:8.0. Use Utils::isHostInNoProxy instead.

is_host_in_noproxy(string $host, array<string|int, string> $noProxyArray) : bool

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
$host : string

Host to check against the patterns.

$noProxyArray : array<string|int, string>

An array of host patterns.

Tags
throws
InvalidArgumentException
Return values
bool

json_decode()

Wrapper for json_decode that throws when an error occurs.

json_decode will be removed in guzzlehttp/guzzle:8.0. Use Utils::jsonDecode instead.

json_decode(string $json[, bool $assoc = false ][, int $depth = 512 ][, int $options = 0 ]) : object|array<string|int, mixed>|string|int|float|bool|null
Parameters
$json : string

JSON data to parse

$assoc : bool = false

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

$depth : int = 512

User specified recursion depth.

$options : int = 0

Bitmask of JSON decode options.

Tags
throws
InvalidArgumentException

if the JSON cannot be decoded.

see
https://www.php.net/manual/en/function.json-decode.php
Return values
object|array<string|int, mixed>|string|int|float|bool|null

json_encode()

Wrapper for JSON encoding that throws when an error occurs.

json_encode will be removed in guzzlehttp/guzzle:8.0. Use Utils::jsonEncode instead.

json_encode(mixed $value[, int $options = 0 ][, int $depth = 512 ]) : string
Parameters
$value : mixed

The value being encoded

$options : int = 0

JSON encode option bitmask

$depth : int = 512

Set the maximum depth. Must be greater than zero.

Tags
throws
InvalidArgumentException

if the JSON cannot be encoded.

see
https://www.php.net/manual/en/function.json-encode.php
Return values
string

        
On this page

Search results