HttpResponse
Read onlyYes
Value object returned by {@see HttpTransport::request()}.
Carries the HTTP status, the response headers (in PSR-7 shape — header
name => array<int, string> of values), the parsed body (typically a
JSON-decoded array, but may be any scalar or null), and the raw body
string for diagnostics.
Tags
Table of Contents
Properties
Methods
- __construct() : mixed
- header() : string|null
- Returns the first value of the given header (case-insensitive), or null when absent.
- isSuccess() : bool
- Returns true when the HTTP status falls in the 2xx range.
Properties
$body
public
mixed
$body
= null
$headers
public
array<string|int, mixed>
$headers
= []
$raw
public
string|null
$raw
= null
$status
public
int
$status
Methods
__construct()
public
__construct(int $status[, array<string, array<string|int, string>> $headers = [] ][, mixed $body = null ][, string|null $raw = null ]) : mixed
Parameters
- $status : int
-
HTTP status code returned by the server.
- $headers : array<string, array<string|int, string>> = []
-
Response headers, PSR-7 style (name => array of values).
- $body : mixed = null
-
Decoded body (array for JSON, scalar for plain text, null when empty).
- $raw : string|null = null
-
Raw response body string (kept for diagnostics / logging).
header()
Returns the first value of the given header (case-insensitive), or null when absent.
public
header(string $name) : string|null
Parameters
- $name : string
Return values
string|nullisSuccess()
Returns true when the HTTP status falls in the 2xx range.
public
isSuccess() : bool