- Full name:
\GuzzleHttp\Psr7\Message
- This class is marked as final and can't be subclassed
- This class is a Final class
Returns the string representation of an HTTP message.
public static toString(\Psr\Http\Message\MessageInterface $message): string
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$message |
\Psr\Http\Message\MessageInterface | Message to convert to a string. |
Get a short summary of the message body.
public static bodySummary(\Psr\Http\Message\MessageInterface $message, int $truncateAt = 120): ?string
Will return null
if the response is not printable.
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$message |
\Psr\Http\Message\MessageInterface | The message to get the body summary |
$truncateAt |
int | The maximum allowed size of the summary |
Attempts to rewind a message body and throws an exception on failure.
public static rewindBody(\Psr\Http\Message\MessageInterface $message): void
The body of the message will only be rewound if a call to tell()
returns a value other than 0
.
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$message |
\Psr\Http\Message\MessageInterface | Message to rewind |
Parses an HTTP message into an associative array.
public static parseMessage(string $message): array
The array contains the "start-line" key containing the start line of the message, "headers" key containing an associative array of header array values, and a "body" key containing the body of the message.
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$message |
string | HTTP request or response to parse. |
Constructs a URI for an HTTP request message.
public static parseRequestUri(string $path, array $headers): string
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$path |
string | Path from the start-line |
$headers |
array | Array of headers (each value an array). |
Parses a request message string into a request object.
public static parseRequest(string $message): \Psr\Http\Message\RequestInterface
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$message |
string | Request message string. |
Parses a response message string into a response object.
public static parseResponse(string $message): \Psr\Http\Message\ResponseInterface
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$message |
string | Response message string. |