Stellar PHP SDK API Documentation

CustomFriendBot
in package

Utility for funding accounts using a custom FriendBot endpoint

This class allows you to use a custom FriendBot service, useful for local development with standalone Stellar networks or private test networks.

Warning: This service should only be used with test networks. Never attempt to use FriendBot with mainnet accounts.

Example:

$bot = new CustomFriendBot("http://localhost:8000/friendbot");
$success = $bot->fundAccount("GABC...XYZ");
if ($success) {
    echo "Account funded successfully";
}
Tags
see
FriendBot

For funding accounts on the official test network

see
FuturenetFriendBot

For funding accounts on Futurenet

Table of Contents

Properties

$friendBotUrl  : string

Methods

__construct()  : mixed
CustomFriendBot constructor
fundAccount()  : bool
Funds an account using the custom FriendBot endpoint
getFriendBotUrl()  : string
Gets the configured FriendBot URL
setFriendBotUrl()  : void
Sets a new FriendBot URL

Properties

Methods

__construct()

CustomFriendBot constructor

public __construct(string $friendBotUrl) : mixed
Parameters
$friendBotUrl : string

The URL of the custom FriendBot service endpoint (e.g., "http://localhost:8000/friendbot")

fundAccount()

Funds an account using the custom FriendBot endpoint

public fundAccount(string $accountId) : bool

Note: Errors are printed to stdout for debugging purposes

Parameters
$accountId : string

The Stellar account ID (56-character public key starting with 'G') to fund

Return values
bool

True if funding succeeded, false otherwise

getFriendBotUrl()

Gets the configured FriendBot URL

public getFriendBotUrl() : string
Return values
string

The FriendBot endpoint URL

setFriendBotUrl()

Sets a new FriendBot URL

public setFriendBotUrl(string $friendBotUrl) : void
Parameters
$friendBotUrl : string

The FriendBot endpoint URL


        
On this page

Search results