Stellar PHP SDK API Documentation

StellarToml
in package

Represents a parsed stellar.toml file according to SEP-1 specification.

The stellar.toml file is used to provide a common place where the Internet can find information about an organization's Stellar integration.

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

SEP-1 Stellar Info File

version
2.7.0

Table of Contents

Properties

$currencies  : Currencies|null
$documentation  : Documentation|null
$generalInformation  : GeneralInformation|null
$principals  : Principals|null
$validators  : Validators|null

Methods

__construct()  : mixed
Creates a StellarToml instance from a TOML string.
currencyFromItem()  : Currency
Constructs a Currency object from a TOML array item.
currencyFromUrl()  : Currency
Loads currency data from a separate TOML file URL.
fromDomain()  : StellarToml
Fetches and parses stellar.toml from a domain.
getCurrencies()  : Currencies|null
getDocumentation()  : Documentation|null
getGeneralInformation()  : GeneralInformation|null
getPrincipals()  : Principals|null
getValidators()  : Validators|null

Properties

Methods

__construct()

Creates a StellarToml instance from a TOML string.

public __construct(string $toml) : mixed

Parses the provided TOML content and populates the general information, documentation, principals, currencies, and validators data.

Parameters
$toml : string

The TOML content to parse

Tags
throws
Exception

If TOML parsing fails

currencyFromItem()

Constructs a Currency object from a TOML array item.

public static currencyFromItem(array<string|int, mixed> $item) : Currency

Parses the currency fields from a TOML array and maps them to a Currency object. This method is used internally by the constructor and currencyFromUrl method.

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

The TOML array containing currency fields

Return values
Currency

The constructed currency object

currencyFromUrl()

Loads currency data from a separate TOML file URL.

public static currencyFromUrl(string $toml) : Currency

Alternately to specifying a currency in its content, stellar.toml can link out to a separate TOML file for the currency by specifying toml="https://DOMAIN/.well-known/CURRENCY.toml" as the currency's only field. This method loads the currency data from that URL.

Parameters
$toml : string

The URL to the currency TOML file

Tags
throws
Exception

If the currency TOML file cannot be fetched or parsed

Return values
Currency

The parsed currency data

fromDomain()

Fetches and parses stellar.toml from a domain.

public static fromDomain(string $domain[, Client|null $httpClient = null ]) : StellarToml

Constructs the URL https://DOMAIN/.well-known/stellar.toml and retrieves the stellar.toml file from the specified domain.

Parameters
$domain : string

The domain to fetch the stellar.toml from (without protocol)

$httpClient : Client|null = null

Optional HTTP client for testing or custom configuration

Tags
throws
Exception

If the stellar.toml file cannot be fetched or parsed

Return values
StellarToml

The parsed stellar.toml file


        
On this page

Search results