The Soneso open source Stellar SDK for PHP provides APIs to build and sign transactions, connect and query Horizon.
// readme
Stellar SDK for PHP
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 23 SEPs.
Installation
composer require soneso/stellar-php-sdk
Requires PHP 8.0+.
Quick examples
Send a payment
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);
Trust an asset
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);
Call a smart contract
Invoke a…