str()
str(\Psr\Http\Message\MessageInterface $message) : string
Returns the string representation of an HTTP message.
Parameters
\Psr\Http\Message\MessageInterface | $message | Message to convert to a string. |
str(\Psr\Http\Message\MessageInterface $message) : string
Returns the string representation of an HTTP message.
\Psr\Http\Message\MessageInterface | $message | Message to convert to a string. |
uri_for(string|\Psr\Http\Message\UriInterface $uri) : \Psr\Http\Message\UriInterface
Returns a UriInterface for the given value.
This function accepts a string or \GuzzleHttp\Psr7\Psr\Http\Message\UriInterface and
returns a UriInterface for the given value. If the value is already a
UriInterface
, it is returned as-is.
string|\Psr\Http\Message\UriInterface | $uri |
stream_for(resource|string|null|integer|float|boolean|\Psr\Http\Message\StreamInterface|callable|\Iterator $resource = '', array $options = array()) : \Psr\Http\Message\StreamInterface
Create a new stream based on the input type.
Options is an associative array that can contain the following keys:
resource|string|null|integer|float|boolean|\Psr\Http\Message\StreamInterface|callable|\Iterator | $resource | Entity body data |
array | $options | Additional options |
if the $resource arg is not valid.
parse_header(string|array $header) : array
Parse an array of header values containing ";" separated data into an array of associative arrays representing the header key value pair data of the header. When a parameter does not contain a value, but just contains a key, this function will inject a key with a '' string value.
string|array | $header | Header to parse into components. |
Returns the parsed header values.
normalize_header(string|array $header) : array
Converts an array of header values that may contain comma separated headers into an array of headers with no comma separated values.
string|array | $header | Header to normalize. |
Returns the normalized header field values.
modify_request(\Psr\Http\Message\RequestInterface $request, array $changes) : \Psr\Http\Message\RequestInterface
Clone and modify a request with the given changes.
The changes can be one of:
\Psr\Http\Message\RequestInterface | $request | Request to clone and modify. |
array | $changes | Changes to apply. |
rewind_body(\Psr\Http\Message\MessageInterface $message)
Attempts to rewind a message body and throws an exception on failure.
The body of the message will only be rewound if a call to tell()
returns a
value other than 0
.
\Psr\Http\Message\MessageInterface | $message | Message to rewind |
try_fopen(string $filename, string $mode) : resource
Safely opens a PHP stream resource using a filename.
When fopen fails, PHP normally raises a warning. This function adds an error handler that checks for errors and throws an exception instead.
string | $filename | File to open |
string | $mode | Mode used to open the file |
if the file cannot be opened
copy_to_string(\Psr\Http\Message\StreamInterface $stream, integer $maxLen = -1) : string
Copy the contents of a stream into a string until the given number of bytes have been read.
\Psr\Http\Message\StreamInterface | $stream | Stream to read |
integer | $maxLen | Maximum number of bytes to read. Pass -1 to read the entire stream. |
on error.
copy_to_stream(\Psr\Http\Message\StreamInterface $source, \Psr\Http\Message\StreamInterface $dest, integer $maxLen = -1)
Copy the contents of a stream into another stream until the given number of bytes have been read.
\Psr\Http\Message\StreamInterface | $source | Stream to read from |
\Psr\Http\Message\StreamInterface | $dest | Stream to write to |
integer | $maxLen | Maximum number of bytes to read. Pass -1 to read the entire stream. |
on error.
hash(\Psr\Http\Message\StreamInterface $stream, string $algo, boolean $rawOutput = false) : string
Calculate a hash of a Stream
\Psr\Http\Message\StreamInterface | $stream | Stream to calculate the hash for |
string | $algo | Hash algorithm (e.g. md5, crc32, etc) |
boolean | $rawOutput | Whether or not to use raw output |
on error.
Returns the hash of the stream
readline(\Psr\Http\Message\StreamInterface $stream, integer $maxLength = null) : string
Read a line from the stream up to the maximum allowed buffer length
\Psr\Http\Message\StreamInterface | $stream | Stream to read from |
integer | $maxLength | Maximum buffer length |
parse_request(string $message) : \GuzzleHttp\Psr7\Request
Parses a request message string into a request object.
string | $message | Request message string. |
parse_response(string $message) : \GuzzleHttp\Psr7\Response
Parses a response message string into a response object.
string | $message | Response message string. |
parse_query(string $str, integer|boolean $urlEncoding = true) : array
Parse a query string into an associative array.
If multiple values are found for the same key, the value of that key value pair will become an array. This function does not parse nested PHP style arrays into an associative array (e.g., foo[a]=1&foo[b]=2 will be parsed into ['foo[a]' => '1', 'foo[b]' => '2']).
string | $str | Query string to parse |
integer|boolean | $urlEncoding | How the query string is encoded |
build_query(array $params, integer|false $encoding = PHP_QUERY_RFC3986) : string
Build a query string from an array of key value pairs.
This function can use the return value of parse_query() to build a query string. This function does not modify the provided keys when an array is encountered (like http_build_query would).
array | $params | Query string parameters. |
integer|false | $encoding | Set to false to not encode, PHP_QUERY_RFC3986 to encode using RFC3986, or PHP_QUERY_RFC1738 to encode using RFC1738. |
get_message_body_summary(\Psr\Http\Message\MessageInterface $message, integer $truncateAt = 120) : null|string
Get a short summary of the message body
Will return null
if the response is not printable.
\Psr\Http\Message\MessageInterface | $message | The message to get the body summary |
integer | $truncateAt | The maximum allowed size of the summary |