PHPackages                             xrplwin/xrpl-txmutationparser - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. xrplwin/xrpl-txmutationparser

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

xrplwin/xrpl-txmutationparser
=============================

Parse XRPL transaction to context aware object.

v1.2.0(10mo ago)01992MITPHPPHP ^8.1.0CI passing

Since Nov 3Pushed 10mo agoCompare

[ Source](https://github.com/XRPLWin/XRPL-TxMutationParser)[ Packagist](https://packagist.org/packages/xrplwin/xrpl-txmutationparser)[ Docs](https://github.com/XRPLWin)[ RSS](/packages/xrplwin-xrpl-txmutationparser/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (4)Versions (27)Used By (0)

[![CI workflow](https://github.com/XRPLWin/XRPL-TxMutationParser/actions/workflows/main.yml/badge.svg)](https://github.com/XRPLWin/XRPL-TxMutationParser/actions/workflows/main.yml)[![GitHub license](https://camo.githubusercontent.com/bdec175c84627b9ed3bd978fc6d43c706b6e03331de8b90c5bbe27e478461a51/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f5852504c57696e2f5852504c2d54784d75746174696f6e506172736572)](https://github.com/XRPLWin/XRPL-TxMutationParser/blob/main/LICENSE)[![Total Downloads](https://camo.githubusercontent.com/f33dcc116a479f8c2d65cbe89fdd9e0bc745f22adcf09857a7d930cb4a02803f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7872706c77696e2f7872706c2d74786d75746174696f6e7061727365722e7376673f7374796c653d666c6174)](https://packagist.org/packages/xrplwin/xrpl-txmutationparser)

XRPL Transaction Mutation Parser for PHP
========================================

[](#xrpl-transaction-mutation-parser-for-php)

Demo
----

[](#demo)

See this in action on [XRPLWin Playground](https://playground.xrpl.win/play/xrpl-transaction-mutation-parser)

Description
-----------

[](#description)

Parse XRPL transaction to context aware object for visual representation. It takes a XRPL transaction (outcome, meta) and an XRPL account. The XRPL account is the context from which the XPRL transaction is to be interpreted.

The account can be the sender, recipient, or an intermediate account. An intermediate account applies if e.g. there's a trade happening, touching your own offer asynchronously. You put up an offer and at some point down the road it gets (possibly partially) consumed. Alternatively, you can be an Intermediate account if you are a regular key signer or if something is rippling through your account.

The lib. then parses everything, performs all logic (include fee or not, etc.) and returns an object that is ready for use in e.g. an event list, or transaction details view, with all relevant objects parsed &amp; calculated.

This is PHP port of  by [@XRPL Labs](https://github.com/XRPL-Labs)

### Note

[](#note)

This package is provided as is, please test it yourself first.
Found a bug? [Report issue here](https://github.com/XRPLWin/XRPL-TxMutationParser/issues/new)

Requirements
------------

[](#requirements)

- PHP 8.1 or higher
- [Composer](https://getcomposer.org/)

Installation
------------

[](#installation)

To install run

```
composer require xrplwin/xrpl-txmutationparser

```

Usage
-----

[](#usage)

```
use XRPLWin\XRPLTxMutatationParser\TxMutationParser;

$referenceAccount = "rA...";
$tx = (object)[ // Full XRPL transaction, containing Account, Destination, meta, ...)
    "Account": "rA...",
    "Amount": "100300000",
    "Destination": "rD....",
    "Fee": "10000",
    ...
    "meta" => [ ... ],
    ...
];

//Enable to include trading fees calculation in allBalanceChanges results
$calculateTradingFees = false;

$TxMutationParser = new TxMutationParser($referenceAccount, $tx, $calculateTradingFees);
$parsedTransaction = $TxMutationParserRef->result();

print_r($parsedTransaction);
```

A sample response (as JSON):

```
{
  self: {
    feePayer: true,
    account: 'rA...',
    balanceChangesExclFee: [ [Object], [Object], ... ],
    balanceChanges: [ [Object], [Object], ... ],
    tradingFees: [ [Object], ... ] //Optional
  },
  type: 'TRADE',
  eventList: {
    primary: { ... },
    secondary: { ... },
  },
  eventFlow: {
    start: {
      account: 'rB...',
      mutation: [Object]
    },
    intermediate: {
      account: 'rA...',
      mutations: {'in' => ?Object, 'out' => ?Object}
    },
    end: {
      account: 'rC...',
      mutation: [Object]
    }
  },
  allBalanceChanges: {
    rB: [ [Object], [Object], ... ],
    rA: [ [Object], [Object], ... ],
    rC: [ [Object], ... ]
  }
}
```

Scenario's (data contents)
--------------------------

[](#scenarios-data-contents)

#### Event List (`eventList`, e.g. a list with transactions belonging to the context account)

[](#event-list-eventlist-eg-a-list-with-transactions-belonging-to-the-context-account)

If no balance changes to your context account applied: empty. If only one relevant change (e.g. payment in / out): only the `eventList.primary` object exists. If a trade happened and your account both sent and received / exchanged something, the `eventList.primary` object is the main balance change. For reference, the `eventList.secondary` value can be displayed as well.

`eventList.secondary.counterparty` can be array of counterparties if viewing account is issuer and multi balances of currency is adjusted (rippled) trough multiple parties ([see sample here](https://playground.xrpl.win/play/xrpl-transaction-mutation-parser?hash=A357FD7C8F0BBE7120E62FD603ACBE98819BC623D5D12BD81AC68564393A7792&ref=rhub8VRN55s94qWKDv6jmDy1pUykJzF3wq)) where `eventList.secondary.value` is SUM of balance changes of that currency - this behaviour is different from XRPL Labs package.

A common scenario where the `eventList` is completely empty, is if your context account is eg. the account an issued currency rippled through, or the context account is the regular key, signing the transaction parsed.

#### Event Flow (`eventFlow`, e.g. transaction details page viewed by the context account)

[](#event-flow-eventflow-eg-transaction-details-page-viewed-by-the-context-account)

The `eventFlow` object can contain a `eventFlow.start`, `eventFlow.intermediate` and `eventFlow.end` object. The `start` and `end` object can contain a `mutation` (one, so e.g. `eventFlow.start.mutation`).

The `eventFlow.intermediate` object can contain multiple `mutations`, an `in` and `out` (or only `in`, or (more commonly) only `out`) mutation: `eventFlow.intermediate.mutations.in` / `eventFlow.intermediate.mutations.out`.

The `eventFlow` object can contain **only** a `intermediate` object (so no `start` and `end` object) if:

- The transaction is of the mutation type `SET` (e.g. Regular Key set, AccountSet, putting up an XRPL offer, etc.)
- The context account is the issuer of a transaction, and the transaction is rippling through
- The context account is the signer using a regular key, and no balance changes apply to the context account

##### Display logic:

[](#display-logic)

Always show then in this order (if present)

- start
- intermediate
- end

... And only (but always) show them if they are present.

#### Balance changes (`allBalanceChanges`)

[](#balance-changes-allbalancechanges)

All Balance Changes returns balance changes for every participant. If `calculateTradingFees` enabled, balance changes also include trading fee calculations.

Running tests
-------------

[](#running-tests)

Run all tests in "tests" directory.

```
composer test

```

or

```
./vendor/bin/phpunit --testdox

```

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance55

Moderate activity, may be stable

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~39 days

Recently: every ~167 days

Total

26

Last Release

301d ago

Major Versions

v0.0.11 → v1.0.02023-03-09

v0.0.12 → v1.0.12023-03-29

### Community

Maintainers

![](https://www.gravatar.com/avatar/02b0ccc19f65ae6ac53ec11a802ad35565047f862eeccde3a7291917920f9160?d=identicon)[xrplwin](/maintainers/xrplwin)

---

Top Contributors

[![zgrguric](https://avatars.githubusercontent.com/u/108837406?v=4)](https://github.com/zgrguric "zgrguric (59 commits)")

---

Tags

parserphpphp8transactionxrplcomposermutationparserpackagerippletransactionxrptxxrplperspectiverippled

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/xrplwin-xrpl-txmutationparser/health.svg)

```
[![Health](https://phpackages.com/badges/xrplwin-xrpl-txmutationparser/health.svg)](https://phpackages.com/packages/xrplwin-xrpl-txmutationparser)
```

###  Alternatives

[composer-unused/symbol-parser

Toolkit to parse symbols from a composer package

145.7M2](/packages/composer-unused-symbol-parser)[joshdifabio/composed

Easily parse your project's Composer configuration, and those of its dependencies, at runtime.

53273.0k7](/packages/joshdifabio-composed)[leonelquinteros/php-toml

PHP parser for TOML language ( https://github.com/toml-lang/toml )

266.7k](/packages/leonelquinteros-php-toml)[hardcastle/xrpl_php

PHP SDK / Client for the XRP Ledger

129.7k5](/packages/hardcastle-xrpl-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
