Maintenance and API improvements
- Account transaction/payment queries:
Account::getTransactions()andAccount::getPayments()acceptorderandincludeFailedparameters and forward them to Horizon.- These methods now declare
HorizonExceptionin their docs.
- Transaction model enhancements:
- Added
Transaction::isSuccessful()/setIsSuccessful()and map the Horizonsuccessfulfield. - Use
fee_chargedwhen present, and throwHorizonExceptionon unhandled payment types.
- Added
- XDR encoding:
signedBigInteger64now handles zero values without triggering GMP errors.
- Testing/tooling:
- Integration setup and test bootstrapping now provide environment fallbacks and actionable guidance.
- Integration and hardware wallet scripts now resolve PHPUnit from the package, a consumer install, or PATH.
- Integration runner detects missing fixtures and can prompt to run the setup script.
Maintenance release
- Testing/tooling:
- Added a portable PHPUnit bootstrap for running from the package or a consumer project.
- PHPUnit config now uses the new bootstrap and excludes integration/hardware groups by default.
- Integration setup now uses the portable bootstrap and provides environment fallbacks.
Patch release
- Date parsing and nullability:
Transaction::getCreatedAt(),Operation::getCreatedAt(), andLedger::getClosedAt()now return nullableDateTime(?DateTime).- Timestamps are parsed via PHP's flexible
DateTimeto accept Horizon RFC3339 strings withZor offsets; unparsable values yieldnull.
Enhancements and compatibility fixes
- Added
Account::getPaymentOperations($sinceCursor = null, $limit = 50)which returns only payment-like operations (payment,path_payment). Use this when you want to ignorecreate_accountandaccount_mergerecords that also appear in Horizon's payments feed.Account::getPayments()remains unchanged and returns the heterogeneous feed. - Standardized amount formatting at Stellar precision (7 decimal places):
StellarAmount::getScaledValue()andAssetAmount::getBalance()return strings with 7 decimals.Account::getNativeBalance()returns a 7-decimal string (e.g., "0.0000000" when empty).- Stroop accessors return integer strings (no decimals) and are recommended for arithmetic/comparison.
- PHP 8.3 / PHPUnit 9 compatibility:
- Replaced deprecated
@expectedExceptionannotations with$this->expectException(...). Xdr\\Type\\VariableArrayimplementsCountable.- Declared
$sizeonXdr\\XdrBuffer(no dynamic property). - Hardened
XdrModel\\Memovalidation to avoid null-related deprecations.
- Replaced deprecated
- Horizon behavior resilience:
Server::getAccount()now detects JSON bodies withstatus: 404and returnsnull(previously could throw when certain Horizons didn’t raise exceptions).ApiClient::postTransaction()throwsPostTransactionExceptionon non-2xx (4xx) responses even when Guzzle exceptions are disabled.
- Integration test improvements:
- Tests skip gracefully when
STELLAR_HORIZON_BASE_URLis not set. - Base class auto-funds core fixtures (
basic1,basic2,basic3) via friendbot and polls Horizon to avoid flakiness. - Environment variables simplified: tests now use only
STELLAR_NETWORK_PASSPHRASE(deprecatedSTELLAR_NETWORK_PASSWORD).
- Tests skip gracefully when
- Tooling/documentation:
- Normalized shell script line endings (LF) and added
.gitattributesto enforce. - README: documented payments feed vs. payment operations, amount formatting/precision, and integration environment setup.
- Normalized shell script line endings (LF) and added
- Additional support for BumpSequenceOp: it is now read correctly when listing operations
- Convenience method for checking if an account is valid:
Account::isValidAccount - Convenience method for checking if an account exists on the network (is funded):
Server::accountExists getTransactionHash()is now supported on all operations (if Horizon includes it in the response)- HTTP Client can now be retrieved and overridden for testing or if you want to use a custom one
TransactionBuildernow always uses aBigIntegerinternally when working with account sequence numbers- Reduced the number of times an API call is made to Horizon to get the account's sequence number. Thanks to @rhysied for pointing out this issue!
Maintenance release
- TransactionBuilder setMemo() now returns the TransactionBuilder
- Improved error reporting and error messages
- Fixed stream payments example
Added support for BumpSequenceOp
Note that this is for forward compatibility. This operation is not yet available in the Stellar test or production networks.
Use empty() instead of count() for checking if operationResultCodes are present (thanks @omarfurrer)
Fix "Only variables should be passed by reference" notice in several XdrDecoder / XdrEncoder methods (thanks @natrod)
Initial support for parsing binary XDR into PHP objects.
See examples/transaction-add-signature.php
To sign existing XDR:
$server = Server::testNet();
$transactionEnvelope = TransactionEnvelope::fromXdr(new XdrBuffer($xdr));
$transactionEnvelope->sign($keypair, $server);
$server->submitB64Transaction($transactionEnvelope->toBase64());This release adds parsing of the Transaction response so you can get detailed information on the result of each operation.
- When submitting a transaction, you will now get back an instance of
PostTransactionResponse - If a transaction fails due to a failing operation, a
PostTransactionExceptionis now thrown
These two new classes have methods for retrieveing details about each operation within the transaction.
In addition, the text transaction result and operation results from the Horizon response are now included (thanks @omarfurrer)
Breaking Changes / Incompatibilities
- Refactored
getPaymentsandstreamPaymentsto return a newAssetTransferInterfaceinstead of aPaymentobject. See details below.
This release is to refactor how payments are handled. The Horizon /accounts/<account ID>/payments endpoint
returns a variety of operations, all of which represent XLM or another asset being transferred:
- Payment
- Path payment
- Create account
- Merge account
Methods that previously returned a Payment will now return AssetTransferInterface
To migrate your code:
- Replace any calls to
$payment->getType()with$payment->getAssetTransferType(). This will return a string describing the operation type - Replace
$payment->getAmount()with$payment->getAssetAmount()
Breaking Changes / Incompatibilities
- Removed previously deprecated
CreateAccountXdrOperation
New Features / Fixes:
- "Create Account" operations are no longer included when streaming payments.
Previously, they would cause a crash since they could not be decoded to
Paymentobjects. - Fixes and clarifications on several of the "getting started" examples
Account::getDatahas been improved to base64-decode the account data automatically- Added
Payment::getTransactionHash()(contributed by @cballou) - Several improvements to signature handling so that pre-authorized transactions can be submitted
- Fixed an issue encoding variable length opaque structures
- Fees are now calculated correctly for transactions with multiple operations
Keypairobjects can now be created from public keys (a secret key is no longer required). SeeKeypair::newFromPublicKey- Fix to
ManageDataOpXDR encoding
- Fixed an issue where the private key was used instead of the public key when building signer XDR
Breaking Changes / Incompatibilities
- IMPORTANT: arguments to
PaymentOphave changed (the destination is now the first argument and source is an optional argument) Server->getAccount()now returnsnullif an account is not found. Previously, it threw an exception.CreateAccountXdrOperationhas been deprecated and replaced withCreateAccountOp. It will be removed in version 1.2.0PaymentOp::newNativePaymentnow hassourceAccountIdas an optional argument that comes lastPaymentOp::newCustomPaymentnow hassourceAccountIdas an optional argument that comes lastTransactionBuilder::addCustomAssetPaymentOpnow hassourceAccountIdas an optional argument that comes last
New Features
- All operations are now supported by
TransactionBuilder - Better error handling with
HorizonExceptionclass that provides detailed information pulled from Horizon's REST API error messages. - Added
StellarAmountclass for working with numbers that may exceed PHP integer limits - General improvements to large number checks and more tests added
- Initial beta version