|
static | chooseHandler () |
| Chooses and creates a default handler to use based on the environment.
|
|
static | currentTime () |
| Wrapper for the hrtime() or microtime() functions (depending on the PHP version, one of the two is used)
|
|
static | debugResource ($value=null) |
| Returns a debug stream based on the provided variable.
|
|
static | defaultCaBundle () |
| Returns the default cacert bundle for the current system.
|
|
static | defaultUserAgent () |
| Get the default User-Agent string to use with Guzzle.
|
|
static | describeType ($input) |
|
static | getenv (string $name) |
|
static | headersFromLines (iterable $lines) |
| Parses an array of header lines into an associative array of headers.
|
|
static | idnUriConvert (UriInterface $uri, int $options=0) |
|
static | isHostInNoProxy (string $host, array $noProxyArray) |
| Returns true if the provided host matches any of the no proxy areas.
|
|
static | jsonDecode (string $json, bool $assoc=false, int $depth=512, int $options=0) |
| Wrapper for json_decode that throws when an error occurs.
|
|
static | jsonEncode ($value, int $options=0, int $depth=512) |
| Wrapper for JSON encoding that throws when an error occurs.
|
|
static | normalizeHeaderKeys (array $headers) |
| Creates an associative array of lowercase header names to the actual header casing.
|
|
◆ chooseHandler()
static GuzzleHttp\Utils::chooseHandler |
( |
| ) |
|
|
static |
Chooses and creates a default handler to use based on the environment.
The returned handler is not wrapped by any default middlewares.
- Return values
-
callable(\Psr\Http\Message\RequestInterface,array) | GuzzleHttp\Promise\PromiseInterface Returns the best handler for the given system. |
- Exceptions
-
RuntimeException | if no viable Handler is available. |
◆ currentTime()
static GuzzleHttp\Utils::currentTime |
( |
| ) |
|
|
static |
Wrapper for the hrtime() or microtime() functions (depending on the PHP version, one of the two is used)
- Return values
-
◆ debugResource()
static GuzzleHttp\Utils::debugResource |
( |
| $value = null | ) |
|
|
static |
Returns a debug stream based on the provided variable.
- Parameters
-
mixed | $value | Optional value |
- Return values
-
◆ defaultCaBundle()
static GuzzleHttp\Utils::defaultCaBundle |
( |
| ) |
|
|
static |
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.
- Exceptions
-
RuntimeException | if no bundle can be found. |
- Deprecated
- Utils\defaultCaBundle will be removed in guzzlehttp/guzzle:8.0. This method is not needed in PHP 5.6+.
◆ headersFromLines()
static GuzzleHttp\Utils::headersFromLines |
( |
iterable | $lines | ) |
|
|
static |
Parses an array of header lines into an associative array of headers.
- Parameters
-
iterable | $lines | Header lines array of strings in the following format: "Name: Value" |
◆ idnUriConvert()
static GuzzleHttp\Utils::idnUriConvert |
( |
UriInterface | $uri, |
|
|
int | $options = 0 ) |
|
static |
◆ isHostInNoProxy()
static GuzzleHttp\Utils::isHostInNoProxy |
( |
string | $host, |
|
|
array | $noProxyArray ) |
|
static |
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:
- "*" (without quotes) always matches any hosts.
- An exact match.
- 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. |
string[] | $noProxyArray | An array of host patterns. |
- Exceptions
-
◆ jsonDecode()
static GuzzleHttp\Utils::jsonDecode |
( |
string | $json, |
|
|
bool | $assoc = false, |
|
|
int | $depth = 512, |
|
|
int | $options = 0 ) |
|
static |
Wrapper for json_decode that throws when an error occurs.
- Parameters
-
string | $json | JSON data to parse |
bool | $assoc | When true, returned objects will be converted into associative arrays. |
int | $depth | User specified recursion depth. |
int | $options | Bitmask of JSON decode options. |
- Return values
-
object|array|string|int|float|bool|null | |
- Exceptions
-
InvalidArgumentException | if the JSON cannot be decoded. |
- See also
- https://www.php.net/manual/en/function.json-decode.php
◆ jsonEncode()
static GuzzleHttp\Utils::jsonEncode |
( |
| $value, |
|
|
int | $options = 0, |
|
|
int | $depth = 512 ) |
|
static |
Wrapper for JSON encoding that throws when an error occurs.
- Parameters
-
mixed | $value | The value being encoded |
int | $options | JSON encode option bitmask |
int | $depth | Set the maximum depth. Must be greater than zero. |
- Exceptions
-
InvalidArgumentException | if the JSON cannot be encoded. |
- See also
- https://www.php.net/manual/en/function.json-encode.php
The documentation for this class was generated from the following file:
- lib/guzzlehttp/guzzle/src/Utils.php