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
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
$currencies
public
Currencies|null
$currencies
= null
$documentation
public
Documentation|null
$documentation
= null
$generalInformation
public
GeneralInformation|null
$generalInformation
= null
$principals
public
Principals|null
$principals
= null
$validators
public
Validators|null
$validators
= null
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
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
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
Return values
StellarToml —The parsed stellar.toml file
getCurrencies()
public
getCurrencies() : Currencies|null
Return values
Currencies|nullgetDocumentation()
public
getDocumentation() : Documentation|null
Return values
Documentation|nullgetGeneralInformation()
public
getGeneralInformation() : GeneralInformation|null
Return values
GeneralInformation|nullgetPrincipals()
public
getPrincipals() : Principals|null
Return values
Principals|nullgetValidators()
public
getValidators() : Validators|null