Stellar PHP SDK API Documentation

HorizonErrorResponse extends Response

Represents an error response from Horizon

Contains detailed information about errors returned by Horizon, including type, title, status code, details, and optional extras with transaction failure information. Follows RFC 7807 Problem Details format.

Tags
see
HorizonErrorResponseExtras

For additional error details

see
https://developers.stellar.org

Stellar developer docs Horizon Error Handling

since
1.0.0

Table of Contents

Properties

$detail  : string
$extras  : HorizonErrorResponseExtras|null
$extrasJson  : array<string, mixed>|null
$instance  : string|null
$status  : int
$title  : string
$type  : string
$httpClient  : Client|null
$rateLimitLimit  : int|null
$rateLimitRemaining  : int|null
$rateLimitReset  : int|null

Methods

fromJson()  : HorizonErrorResponse
getDetail()  : string
Gets details about the error
getExtras()  : HorizonErrorResponseExtras|null
Gets additional error details for transaction failures
getExtrasJson()  : array<string, mixed>|null
Gets all extras from the response as an array
getHttpClient()  : Client|null
Gets the HTTP client used for pagination requests
getInstance()  : string|null
Gets the Horizon instance identifier
getRateLimitLimit()  : int|null
Returns X-RateLimit-Limit header from the response.
getRateLimitRemaining()  : int|null
Returns X-RateLimit-Remaining header from the response.
getRateLimitReset()  : int|null
Returns X-RateLimit-Reset header from the response. Seconds until a new window starts.
getStatus()  : int
Gets the HTTP status code
getTitle()  : string
Gets a short title describing the status code
getType()  : string
Gets the type of status code returned
setHeaders()  : void
Extracts and sets rate limiting information from HTTP response headers
setHttpClient()  : void
Sets the HTTP client for making follow-up requests
loadFromJson()  : void
Loads response data from a JSON array

Properties

$extrasJson

public array<string, mixed>|null $extrasJson = null

all extras from the response as an array.

$httpClient

protected Client|null $httpClient = null

$rateLimitLimit

protected int|null $rateLimitLimit = null

$rateLimitRemaining

protected int|null $rateLimitRemaining = null

$rateLimitReset

protected int|null $rateLimitReset = null

Methods

getDetail()

Gets details about the error

public getDetail() : string
Return values
string

The error details

getExtras()

Gets additional error details for transaction failures

public getExtras() : HorizonErrorResponseExtras|null

If the status code indicates a transaction failure, this field contains the result code returned by Stellar Core describing why the transaction failed.

Return values
HorizonErrorResponseExtras|null

The extras object, or null if not available

getExtrasJson()

Gets all extras from the response as an array

public getExtrasJson() : array<string, mixed>|null
Return values
array<string, mixed>|null

The extras array, or null if not available

getHttpClient()

Gets the HTTP client used for pagination requests

public getHttpClient() : Client|null
Return values
Client|null

The HTTP client instance, or null if not set

getInstance()

Gets the Horizon instance identifier

public getInstance() : string|null
Return values
string|null

The instance identifier, or null if not available

getRateLimitLimit()

Returns X-RateLimit-Limit header from the response.

public getRateLimitLimit() : int|null

This number represents the he maximum number of requests that the current client can make in one hour.

Tags
see
https://developers.stellar.org

Stellar developer docs Rate limiting documentation

Return values
int|null

getRateLimitRemaining()

Returns X-RateLimit-Remaining header from the response.

public getRateLimitRemaining() : int|null

The number of remaining requests for the current window.

Tags
see
https://developers.stellar.org

Stellar developer docs Rate limiting documentation

Return values
int|null

getRateLimitReset()

Returns X-RateLimit-Reset header from the response. Seconds until a new window starts.

public getRateLimitReset() : int|null
Tags
see
https://developers.stellar.org

Stellar developer docs Rate limiting documentation

Return values
int|null

getStatus()

Gets the HTTP status code

public getStatus() : int
Return values
int

The status code

getTitle()

Gets a short title describing the status code

public getTitle() : string

The title can be used to look up more information about the error.

Return values
string

The error title

getType()

Gets the type of status code returned

public getType() : string

URL to lookup for more information about the error.

Return values
string

The type of status code

setHeaders()

Extracts and sets rate limiting information from HTTP response headers

public setHeaders(array<string|int, mixed> $headers) : void

This method processes the X-Ratelimit-* headers from the HTTP response and stores them for client access.

Parameters
$headers : array<string|int, mixed>

Associative array of HTTP headers from the response

setHttpClient()

Sets the HTTP client for making follow-up requests

public setHttpClient([Client|null $httpClient = null ]) : void

Paginated responses contain links to next/previous pages. This HTTP client is used when following those links to fetch additional pages.

Parameters
$httpClient : Client|null = null

The Guzzle HTTP client to use for pagination

loadFromJson()

Loads response data from a JSON array

protected loadFromJson(array<string|int, mixed> $json) : void

This method is used internally to populate response objects from parsed JSON. Subclasses override this to extract their specific data fields.

Parameters
$json : array<string|int, mixed>

Associative array of parsed JSON data


        
On this page

Search results