Build and sign Stellar transactions, query Horizon, and interact with Soroban smart contracts via RPC. Communicate with anchors and external services using built-in support for 18 SEPs.
composer require soneso/stellar-php-sdkRequires PHP 8.0+.
Transfer XLM between accounts:
$payment = (new PaymentOperationBuilder($receiverId, Asset::native(), '100'))->build();
$tx = (new TransactionBuilder($account))->addOperation($payment)->build();
$tx->sign($senderKeyPair, Network::testnet());
$sdk->submitTransaction($tx);Enable your account to receive a token (like USDC):
$asset = Asset::createNonNativeAsset('USDC', $issuerAccountId);
$trustOp = (new ChangeTrustOperationBuilder($asset))->build();
$tx = (new TransactionBuilder($account))->addOperation($trustOp)->build();
$tx->sign($accountKeyPair, Network::testnet());
$sdk->submitTransaction($tx);Invoke a Soroban contract method:
$client = SorobanClient::forClientOptions(new ClientOptions(
sourceAccountKeyPair: $keyPair,
contractId: 'CABC...',
network: Network::testnet(),
rpcUrl: 'https://soroban-testnet.stellar.org'
));
$result = $client->invokeMethod('hello', [XdrSCVal::forSymbol('World')]);For complete walkthroughs, see the documentation.
| Guide | Description |
|---|---|
| Quick start | Your first transaction in 15 minutes |
| Getting started | Keys, accounts, and fundamentals |
| SDK usage | Transactions, operations, Horizon queries, streaming |
| Soroban | Smart contract deployment and interaction |
| SEPs | Anchor integration, authentication, KYC, etc. |
If you're using this SDK, feedback helps improve it:
See CONTRIBUTING.md for guidelines.
Apache 2.0. See LICENSE.