Stellar PHP SDK API Documentation

Federation

Federation protocol implementation for resolving Stellar addresses.

This class implements SEP-0002 Federation Protocol, which provides a way to resolve human-readable addresses like "bob*example.com" into Stellar account IDs and memo information. It enables user-friendly payment addressing.

Tags
see
https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0002.md
FederationRequestBuilder
FederationResponse

Table of Contents

Methods

resolveForward()  : FederationResponse
Resolves forward federation requests with custom parameters.
resolveStellarAccountId()  : FederationResponse
Performs reverse federation lookup for an account ID.
resolveStellarAddress()  : FederationResponse
Resolves a Stellar address to account ID and memo.
resolveStellarTransactionId()  : FederationResponse
Resolves a transaction ID to federation information.

Methods

resolveForward()

Resolves forward federation requests with custom parameters.

public static resolveForward(array<string|int, mixed> $queryParameters, string $federationServerUrl[, Client|null $httpClient = null ]) : FederationResponse

Used for forwarding payments to different networks or financial institutions. The query parameters vary based on the destination institution type. Example parameters: ['forward_type' => 'bank_account', 'swift' => 'BOPBPHMM', 'acct' => '2382376'] or ['forward_type' => 'remittance_center', 'first_name' => 'John', 'last_name' => 'Doe', 'address' => '123 Main St', 'city' => 'City', 'postal_code' => '12345', 'country' => 'US'].

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

Custom query parameters for forward request.

$federationServerUrl : string

URL of the federation server.

$httpClient : Client|null = null

Optional HTTP client. Default is Guzzle.

Tags
throws
HorizonRequestException

If federation request fails.

Return values
FederationResponse —

Response containing federation information.

resolveStellarAccountId()

Performs reverse federation lookup for an account ID.

public static resolveStellarAccountId(string $accountId, string $federationServerUrl[, Client|null $httpClient = null ]) : FederationResponse
Parameters
$accountId : string

Stellar account ID to lookup.

$federationServerUrl : string

URL of the federation server.

$httpClient : Client|null = null

Optional HTTP client. Default is Guzzle.

Tags
throws
HorizonRequestException

If federation request fails.

Return values
FederationResponse —

Response containing Stellar address if found.

resolveStellarAddress()

Resolves a Stellar address to account ID and memo.

public static resolveStellarAddress(string $address[, Client|null $httpClient = null ]) : FederationResponse
Parameters
$address : string

Stellar address in format "userdomain.com". The username portion must not contain the characters '' or '>'.

$httpClient : Client|null = null

Optional HTTP client. Default is Guzzle.

Tags
throws
Exception

If address format is invalid or federation server not found.

HorizonRequestException

If federation request fails.

Return values
FederationResponse —

Response containing account ID and optional memo.

resolveStellarTransactionId()

Resolves a transaction ID to federation information.

public static resolveStellarTransactionId(string $txId, string $federationServerUrl[, Client|null $httpClient = null ]) : FederationResponse
Parameters
$txId : string

Transaction ID to lookup.

$federationServerUrl : string

URL of the federation server.

$httpClient : Client|null = null

Optional HTTP client. Default is Guzzle.

Tags
throws
HorizonRequestException

If federation request fails.

Return values
FederationResponse —

Response containing federation information.

On this page

Search results