Stellar PHP SDK API Documentation

WordList

BIP-39 word list loader for multiple languages.

This class manages the loading and lookup of BIP-39 word lists in various languages. Each word list contains exactly 2048 words used for mnemonic phrase generation and validation according to the BIP-39 standard.

Tags
see
https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0005.md
see
https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki
see
BIP39
see
Mnemonic

Table of Contents

Constants

LANGUAGE_CHINESE_SIMPLIFIED  = 'chinese_simplified'
LANGUAGE_CHINESE_TRADITIONAL  = 'chinese_traditional'
LANGUAGE_ENGLISH  = "english"
LANGUAGE_FRENCH  = 'french'
LANGUAGE_ITALIAN  = 'italian'
LANGUAGE_JAPANESE  = 'japanese'
LANGUAGE_KOREAN  = 'korean'
LANGUAGE_MALAY  = 'malay'
LANGUAGE_SPANISH  = 'spanish'

Methods

__construct()  : mixed
WordList constructor.
__debugInfo()  : array<int, string>
Provides debug information for var_dump and print_r output.
findIndex()  : int|null
Finds the index of a word in the word list.
getLanguage()  : WordList
Gets a cached word list instance for the specified language.
getWord()  : string|null
Gets the word at the specified index.
which()  : string
Returns the language code of this word list.

Constants

LANGUAGE_CHINESE_SIMPLIFIED

public mixed LANGUAGE_CHINESE_SIMPLIFIED = 'chinese_simplified'

LANGUAGE_CHINESE_TRADITIONAL

public mixed LANGUAGE_CHINESE_TRADITIONAL = 'chinese_traditional'

LANGUAGE_ENGLISH

public mixed LANGUAGE_ENGLISH = "english"

LANGUAGE_FRENCH

public mixed LANGUAGE_FRENCH = 'french'

LANGUAGE_ITALIAN

public mixed LANGUAGE_ITALIAN = 'italian'

LANGUAGE_JAPANESE

public mixed LANGUAGE_JAPANESE = 'japanese'

LANGUAGE_KOREAN

public mixed LANGUAGE_KOREAN = 'korean'

LANGUAGE_MALAY

public mixed LANGUAGE_MALAY = 'malay'

LANGUAGE_SPANISH

public mixed LANGUAGE_SPANISH = 'spanish'

Methods

__construct()

WordList constructor.

public __construct([string $language = WordList::LANGUAGE_ENGLISH ]) : mixed
Parameters
$language : string = WordList::LANGUAGE_ENGLISH

Language code for the word list. Default is English.

Tags
throws
Exception

If the word list file is not found or does not contain exactly 2048 words.

__debugInfo()

Provides debug information for var_dump and print_r output.

public __debugInfo() : array<int, string>

Returns a single-element array containing a human-readable description of the word list language for debugging purposes. Invoked automatically by var_dump() and print_r() when inspecting WordList instances.

Return values
array<int, string>

Indexed array with a formatted language description

findIndex()

Finds the index of a word in the word list.

public findIndex(string $search) : int|null
Parameters
$search : string

The word to search for (case-insensitive).

Return values
int|null

The index of the word, or null if not found.

getWord()

Gets the word at the specified index.

public getWord(int $index) : string|null
Parameters
$index : int

Index in the word list. Valid range is 0-2047 (BIP-39 standard word list size).

Return values
string|null

The word at the index, or null if index is invalid.

which()

Returns the language code of this word list.

public which() : string
Return values
string

The language code.


        
On this page

Search results