Oihana PHP Arango

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
author

Marc Alcaraz (ekameleon)

since
1.0.0

Table of Contents

Properties

$body  : mixed
$headers  : array<string|int, mixed>
$raw  : string|null
$status  : int

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

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|null

isSuccess()

Returns true when the HTTP status falls in the 2xx range.

public isSuccess() : bool
Return values
bool
On this page

Search results