PHPackages                             xrplwin/xrpl-hookparser - 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-hookparser

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

xrplwin/xrpl-hookparser
=======================

Transaction Hook parser for hook-enabled XRPL/Xahau networks.

v2.0.4(6mo ago)52401MITPHPPHP ^8.1.0CI passing

Since Nov 7Pushed 6mo ago2 watchersCompare

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

READMEChangelog (10)Dependencies (3)Versions (24)Used By (0)

[![main workflow](https://github.com/XRPLWin/XRPL-HookParser/actions/workflows/main.yml/badge.svg)](https://github.com/XRPLWin/XRPL-HookParser/actions/workflows/main.yml/badge.svg)[![GitHub license](https://camo.githubusercontent.com/cb7cdb866e063cf4ad5a66da1dfb894f94ec08a7103ce2cfe39d669a1df911c8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f5852504c57696e2f5852504c2d486f6f6b506172736572)](https://github.com/XRPLWin/XRPL-HookParser/blob/main/LICENSE)[![Total Downloads](https://camo.githubusercontent.com/a85e46552b6d8b608ceb542fe90daa1538d789a752533149a588e3d554700e4a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7872706c77696e2f7872706c2d686f6f6b7061727365722e7376673f7374796c653d666c6174)](https://packagist.org/packages/xrplwin/xrpl-hookparser)

HookParser
==========

[](#hookparser)

Transaction Hook parser for hook-enabled XRPL/Xahau networks.

This package takes single transaction, parses metadata and provides info about HookHash-es and accounts.

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

[](#requirements)

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

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

[](#installation)

```
composer require xrplwin/xrpl-hookparser

```

Usage
-----

[](#usage)

### Transaction parser

[](#transaction-parser)

```
use XRPLWin\XRPLHookParser\TxHookParser;

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

$TxHookParser = new TxHookParser($tx);

// All examples below return array:

# List of all hooks in transaction
$hooks = $TxHookParser->hooks();
# List of all accounts that are affected by hooks in transaction
$accounts = $TxHookParser->accounts();
# List of hooks by account*
$accountHooks = $TxHookParser->accountHooks('raddress...');
# List of accounts by hook
$hookAccounts = $TxHookParser->hookAccounts('5EDF6...2DC77');

# List of newly created hooks (new HookDefinition created)
$createdHooks = $TxHookParser->createdHooks();
# List of newly created hooks - detailed
$createdHooksDetails = $TxHookParser->createdHooksDetailed();
# Array key-value parameters contained in created hook
$hookInitialParams = TxHookParser::toParams($createdHooksDetails['5EDF6...2DC77']);
# Check if specific hook is created
$isCreated = $TxHookParser->isHookCreated('5EDF6...2DC77');

# List of destroyed hooks (HookDefinition deleted)
$destroyedHooks = $TxHookParser->destroyedHooks();
# Check if specific hook is destroyed
$isDestroyed = $TxHookParser->isHookDestroyed('5EDF6...2DC77');

# List of uninstalled hooks* (eg. SetHook transaction)
$uninstalledHooks = $TxHookParser->uninstalledHooks();
# List of uninstalled hooks with positions*
$uninstalledHooksPos = $TxHookParser->uninstalledHooksPos();
# List of uninstalled hooks with num uninstalls
$uninstalledHooksStats = $TxHookParser->uninstalledHooksStats();
# List of installed hooks* (eg. SetHook transaction)
$installedHooks = $TxHookParser->installedHooks();
# List of installed hooks with positions*
$installedHooksPos = $TxHookParser->installedHooksPos();
# List of installed hooks with num installs
$installedHooksStats = $TxHookParser->installedHooksStats();
# List of modified hooks*
$modifiedHooks = $TxHookParser->modifiedHooks();
# List of modified hooks with positions*
$modifiedHooksPos = $TxHookParser->modifiedHooksPos();
# List of unmodified hooks*
$unmodifiedHooks = $TxHookParser->unmodifiedHooks();
# List of unmodified hooks with positions*
$unmodifiedHooksPos = $TxHookParser->unmodifiedHooksPos();
# Manual data lookup (lookup any combination of mapped data)
$lookup = $TxHookParser->lookup('raddress...','Hook','installed');

# * Methods that can return multiple same hook hashes, for example if
#   account has same hook on two or more positions installed, it is
#   important to differentiate hook "instance" on account vs hook
#   create and destroy actions. List of hooks always returns unique hashes.
```

### HookOn/HookCanEmit field

[](#hookonhookcanemit-field)

See  for reference.

Decode HookOn or HookCanEmit String

```
use XRPLWin\XRPLHookParser\HookOn;

$triggered = HookOn::decode('0xfffffffffffffffffffffffffffffffffffffff7fffffffffffc1fffffc00a40'); //array
/*
$triggered = array:26 [
  0 => "ttPAYMENT"
  1 => "ttESCROW_CREATE"
  ...
]
*/
//No triggers in this sample:
HookOn::decode('0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbfffff');
//Works without prefix:
HookOn::decode('ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbfffff');
//Works with uppercase and lowercase:
HookOn::decode('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFFFFF');
HookOn::decode('0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFFFFF');
HookOn::decode('0XFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFFFFF');
```

Encode HookOn or HookCanEmit String

```
use XRPLWin\XRPLHookParser\HookOn;

HookOn::encode([HookOn::ttACCOUNT_DELETE]);
//= (string)'0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9fffff'

HookOn::encode([]);
//= (string)'0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbfffff'

HookOn::encode([HookOn::ttACCOUNT_DELETE,HookOn::ttACCOUNT_SET]);
//= (string)'0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9ffff7'
```

What is new in version 2.x
--------------------------

[](#what-is-new-in-version-2x)

Version 2.x brings overhaul of hook detection code and now positions are tracked, which in return allows new methods listed below. For each installed, modified and uninstalled hook on account it is possible to get position in which change was occurred. Modified Hooks method now does not return hooks which was reinstalled but contents are not changed (Flag=0 is normalized), those are now available in `unmodifiedHooks` and `unmodifiedHooksPos` methods.

- Added `uninstalledHooksPos()` method
- Added `installedHooksPos()` method
- Changed `modifiedHooks()` method
- Added `modifiedHooksPos()` method
- Added `unmodifiedHooks()` method
- Added `unmodifiedHooksPos()` method

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

[](#running-tests)

Run all tests in "tests" directory.

```
composer test

```

or

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

```

References
----------

[](#references)

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance68

Regular maintenance activity

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

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 ~35 days

Recently: every ~160 days

Total

22

Last Release

189d ago

Major Versions

v1.2.1 → v2.0.02024-02-09

### 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 (48 commits)")

---

Tags

hookshooks-apixahauxahaudcomposerparserpackagehooksHOOKtransactionxrptxxrplperspectiveparticipatsxahauxah

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  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)[open-code-modeling/json-schema-to-php

Parses JSON schema files and provides an API to easily generate code from JSON schema.

111.0k2](/packages/open-code-modeling-json-schema-to-php)

PHPackages © 2026

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