Stellar PHP SDK API Documentation

AccountResponse extends Response implements TransactionBuilderAccount

Represents a single account on the Stellar network with all its details

This response contains comprehensive account information including balances, signers, thresholds, flags, data entries, and sponsorship details. The account response is returned by the accounts endpoint and implements TransactionBuilderAccount for use in transaction building.

Key fields:

  • Account ID and sequence number for transaction building
  • Balances for all assets held by the account
  • Signers and their weights for multi-signature operations
  • Thresholds for low, medium, and high security operations
  • Authorization flags for asset issuers
  • Data entries stored on the account
  • Sponsorship information for reserve requirements

The account response is returned by these Horizon endpoints:

  • GET /accounts/{account_id} - Single account details
  • GET /accounts - List of accounts
Tags
see
https://developers.stellar.org

Stellar developer docs Horizon Accounts API

see
AccountBalanceResponse

For balance details

see
AccountSignerResponse

For signer details

see
AccountThresholdsResponse

For threshold values

see
AccountFlagsResponse

For authorization flags

since
1.0.0

Table of Contents

Interfaces

TransactionBuilderAccount
Interface for accounts used in transaction building.

Properties

$httpClient  : Client|null
$rateLimitLimit  : int|null
$rateLimitRemaining  : int|null
$rateLimitReset  : int|null

Methods

fromJson()  : AccountResponse
Creates an AccountResponse instance from JSON data
getAccountId()  : string
Gets the unique account ID (public key) of this account
getBalances()  : AccountBalancesResponse
Gets all asset balances held by this account
getData()  : AccountDataResponse
Gets all data entries stored on this account
getFlags()  : AccountFlagsResponse
Gets the authorization flags set on this account
getHomeDomain()  : string|null
Gets the home domain associated with this account
getHttpClient()  : Client|null
Gets the HTTP client used for pagination requests
getIncrementedSequenceNumber()  : BigInteger
Gets the next sequence number that should be used for a transaction
getInflationDestination()  : string|null
Gets the account designated to receive inflation
getKeyPair()  : KeyPair
Gets the KeyPair for this account
getLastModifiedLedger()  : int
Gets the ledger sequence number when this account was last modified
getLastModifiedTime()  : string
Gets the timestamp when this account was last modified
getLinks()  : AccountLinksResponse
Gets the links to related resources for this account
getMuxedAccount()  : MuxedAccount
Gets a MuxedAccount representation of this account
getMuxedAccountMed25519Id()  : int|null
Gets the multiplexed account ID if this account is used as a MuxedAccountMed25519
getNumSponsored()  : int
Gets the number of reserves being sponsored for this account
getNumSponsoring()  : int
Gets the number of reserves this account is sponsoring for other accounts
getPagingToken()  : string
Gets the paging token for this account in list results
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.
getSequenceLedger()  : int|null
Gets the ledger sequence number when the sequence number was last updated
getSequenceNumber()  : BigInteger
Gets the current sequence number for this account
getSequenceTime()  : string|null
Gets the timestamp when the sequence number was last updated
getSigners()  : AccountSignersResponse
Gets all signers configured for this account
getSponsor()  : string|null
Gets the account ID of the sponsor for this account
getSubentryCount()  : int
Gets the number of subentries (trustlines, offers, data, etc.) on this account
getThresholds()  : AccountThresholdsResponse
Gets the signature thresholds for this account
incrementSequenceNumber()  : void
Increments the sequence number by one
setHeaders()  : void
Extracts and sets rate limiting information from HTTP response headers
setHttpClient()  : void
Sets the HTTP client for making follow-up requests
setMuxedAccountMed25519Id()  : void
Sets the multiplexed account ID to be used if this account is used as MuxedAccountMed25519
loadFromJson()  : void
Loads response data from a JSON array

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 an AccountResponse instance from JSON data

public static fromJson(array<string|int, mixed> $json) : AccountResponse
Parameters
$json : array<string|int, mixed>

The JSON array containing account data from Horizon

Return values
AccountResponse

The parsed account response

getAccountId()

Gets the unique account ID (public key) of this account

public getAccountId() : string
Return values
string

The account ID in Stellar public key format (G...)

getHomeDomain()

Gets the home domain associated with this account

public getHomeDomain() : string|null

The home domain can be used for federation and to identify the organization controlling the account.

Return values
string|null

The home domain, or null if not set

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

getIncrementedSequenceNumber()

Gets the next sequence number that should be used for a transaction

public getIncrementedSequenceNumber() : BigInteger

This returns the current sequence number plus one, which is required for the next transaction.

Return values
BigInteger

The incremented sequence number

getInflationDestination()

Gets the account designated to receive inflation

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

The inflation destination account ID, or null if not set

getKeyPair()

Gets the KeyPair for this account

public getKeyPair() : KeyPair

The KeyPair is derived from the account ID and can be used for signing operations.

Return values
KeyPair

The cryptographic key pair for this account

getLastModifiedLedger()

Gets the ledger sequence number when this account was last modified

public getLastModifiedLedger() : int
Return values
int

The ledger sequence number

getLastModifiedTime()

Gets the timestamp when this account was last modified

public getLastModifiedTime() : string
Return values
string

The modification time in ISO 8601 format

getMuxedAccount()

Gets a MuxedAccount representation of this account

public getMuxedAccount() : MuxedAccount

If a muxed account ID has been set, this returns a multiplexed account.

Return values
MuxedAccount

The muxed account representation

getMuxedAccountMed25519Id()

Gets the multiplexed account ID if this account is used as a MuxedAccountMed25519

public getMuxedAccountMed25519Id() : int|null
Return values
int|null

The muxed account ID, or null if not set

getNumSponsored()

Gets the number of reserves being sponsored for this account

public getNumSponsored() : int
Return values
int

The count of reserves being sponsored

getNumSponsoring()

Gets the number of reserves this account is sponsoring for other accounts

public getNumSponsoring() : int
Return values
int

The count of sponsored reserves

getPagingToken()

Gets the paging token for this account in list results

public getPagingToken() : string
Return values
string

The paging token used for cursor-based pagination

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

getSequenceLedger()

Gets the ledger sequence number when the sequence number was last updated

public getSequenceLedger() : int|null
Return values
int|null

The ledger sequence number, or null if not available

getSequenceNumber()

Gets the current sequence number for this account

public getSequenceNumber() : BigInteger

The sequence number must be incremented for each transaction submitted by this account.

Return values
BigInteger

The current sequence number

getSequenceTime()

Gets the timestamp when the sequence number was last updated

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

The sequence update time in ISO 8601 format, or null if not available

getSponsor()

Gets the account ID of the sponsor for this account

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

The sponsor account ID, or null if not sponsored

getSubentryCount()

Gets the number of subentries (trustlines, offers, data, etc.) on this account

public getSubentryCount() : int

Each subentry requires a base reserve to be maintained in the account balance.

Return values
int

The count of subentries

incrementSequenceNumber()

Increments the sequence number by one

public incrementSequenceNumber() : void

This should be called after successfully submitting a transaction to keep the local account state in sync with the network.

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

setMuxedAccountMed25519Id()

Sets the multiplexed account ID to be used if this account is used as MuxedAccountMed25519

public setMuxedAccountMed25519Id(int|null $muxedAccountMed25519Id) : void
Parameters
$muxedAccountMed25519Id : int|null

The muxed account ID, or null to unset

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