TransactionsPageResponse
extends PageResponse
in package
Represents a paginated collection of transactions from Horizon
This response extends PageResponse to provide cursor-based pagination for transaction lists. Transactions are returned in a TransactionsResponse collection along with navigation links to fetch additional pages of results.
Pagination is controlled by limit and cursor parameters:
- limit: Maximum number of transactions per page (default 10, max 200)
- cursor: Paging token to resume from a specific position
- order: Sort order (asc or desc, default desc for newest first)
Navigation methods allow fetching next and previous pages while maintaining the same query parameters. The page includes HAL links for programmatic navigation.
Returned by Horizon endpoints that provide transaction lists:
- GET /transactions - All network transactions
- GET /accounts/{account_id}/transactions - Account transactions
- GET /ledgers/{sequence}/transactions - Ledger transactions
- GET /liquidity_pools/{pool_id}/transactions - Liquidity pool transactions
Tags
Table of Contents
Properties
- $httpClient : Client|null
- $rateLimitLimit : int|null
- $rateLimitRemaining : int|null
- $rateLimitReset : int|null
Methods
- fromJson() : TransactionsPageResponse
- Creates a TransactionsPageResponse instance from JSON data
- getHttpClient() : Client|null
- Gets the HTTP client used for pagination requests
- getLinks() : PagingLinksResponse
- Gets the pagination links for navigating between pages
- getNextPage() : TransactionsPageResponse|null
- Fetches the next page of transactions
- getPreviousPage() : TransactionsPageResponse|null
- Fetches the previous page of transactions
- 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.
- getTransactions() : TransactionsResponse
- Gets the collection of transactions in this page
- hasNextPage() : bool
- Checks if a next page exists
- hasPrevPage() : bool
- Checks if a previous page exists
- setHeaders() : void
- Extracts and sets rate limiting information from HTTP response headers
- setHttpClient() : void
- Sets the HTTP client for making follow-up requests
- executeRequest() : Response|null
- getNextPageUrl() : string|null
- getPrevPageUrl() : string|null
- loadFromJson() : void
- Loads page data from JSON response
Properties
$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
fromJson()
Creates a TransactionsPageResponse instance from JSON data
public
static fromJson(array<string|int, mixed> $json) : TransactionsPageResponse
Parameters
- $json : array<string|int, mixed>
-
The JSON array containing page data from Horizon
Return values
TransactionsPageResponse —The parsed transactions page response
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
getLinks()
Gets the pagination links for navigating between pages
public
getLinks() : PagingLinksResponse
Return values
PagingLinksResponse —The navigation links (next, prev, self)
getNextPage()
Fetches the next page of transactions
public
getNextPage() : TransactionsPageResponse|null
Uses the next page URL from HAL links to retrieve the subsequent page of results with the same query parameters.
Return values
TransactionsPageResponse|null —The next page, or null if no next page exists
getPreviousPage()
Fetches the previous page of transactions
public
getPreviousPage() : TransactionsPageResponse|null
Uses the previous page URL from HAL links to retrieve the prior page of results with the same query parameters.
Return values
TransactionsPageResponse|null —The previous page, or null if no previous page exists
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
Return values
int|nullgetRateLimitRemaining()
Returns X-RateLimit-Remaining header from the response.
public
getRateLimitRemaining() : int|null
The number of remaining requests for the current window.
Tags
Return values
int|nullgetRateLimitReset()
Returns X-RateLimit-Reset header from the response. Seconds until a new window starts.
public
getRateLimitReset() : int|null
Tags
Return values
int|nullgetTransactions()
Gets the collection of transactions in this page
public
getTransactions() : TransactionsResponse
Return values
TransactionsResponse —The iterable collection of transaction responses
hasNextPage()
Checks if a next page exists
public
hasNextPage() : bool
Return values
bool —True if there is a next page available
hasPrevPage()
Checks if a previous page exists
public
hasPrevPage() : bool
Return values
bool —True if there is a previous page available
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
executeRequest()
protected
executeRequest(string $requestType[, string|null $url = null ]) : Response|null
Parameters
- $requestType : string
- $url : string|null = null
Tags
Return values
Response|nullgetNextPageUrl()
protected
getNextPageUrl() : string|null
Return values
string|nullgetPrevPageUrl()
protected
getPrevPageUrl() : string|null
Return values
string|nullloadFromJson()
Loads page data from JSON response
protected
loadFromJson(array<string|int, mixed> $json) : void
Parameters
- $json : array<string|int, mixed>
-
The JSON array containing page data from Horizon