Download the PHP package xrplwin/xrpl without Composer
On this page you can find all versions of the php package xrplwin/xrpl. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package xrpl
PHP XRPL API Connector
Requirements
- PHP 8.1 or higher
- Composer
Installation
Usage sample
In sample below we will be using account_tx method.
Init Client
Creating first request
This will return an instance of XRPLWin\XRPL\Api\Methods\AccountTx
.
Custom rate limit handling
If you wish to define custom behaviour when request is rate-limited you can via Closure
function. Define this before executing send()
.
Fetching response
Class method send()
executes request against XRPLedger and response is stored into instance object. After that you can use one of provided class methods to retrieve result.
Promises
Alternative to fetch syncronous response as defined above, you can get Promise
Read more about Promises. Returned object is Promises/A+ implementation.
Notes: You will need to handle rate limiting and exception handling yourself when using Promises. Also each promise must be created from new instance of \XRPLWin\XRPL\Client
this is to make sure each promise has its own seperated HttpClient instance.
Paginating result
To quick retrieve next instance to be executed (next page) you can use next()
. This class method will return instance of XRPLWin\XRPL\Api\Methods\AccountTx
with same parameters plus added marker from previous request. This helper function is not mandatory, you can always create new method instance manually like this $client->api('account_tx')->params([ ..., ['marker'] => [ ... ]]
.
See samples for more information.
Request workflow
- Prepare instance by setting params
- Use send() to execute request and handle errors by using try catch. (Request will be re-tried x amount of times if rate-limit is detected)
- XRPLedger response is stored in memory and it is available to read via
->result()
->resultArray()
->finalResult()
Methods
account_tx
tx
For other methods refer to https://xrpl.org/websocket-api-tool.html and src/Api/Methods
Utilities
There are few utilities available with this package:
- Balance changes (with tranding fees optional calculation)
- Flags
- UNLReport Flag Ledger
- Currency code to readable currency code
Flags
UNLReportFlagLedger
Flag ledger is calculated using modulo formula LedgerIndex % 256.
Util class
Converts Currency Code ISO or HEX to human readable representation.
Read more:
- https://xrpl.org/docs/references/protocol/data-types/currency-formats/#currency-formats
- https://xrpl.org/docs/concepts/tokens/fungible-tokens/demurrage/
Running tests
Run all tests in "tests" directory.
or