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.5(1w ago)52461MITPHPPHP ^8.1.0CI passing

Since Nov 7Pushed 1w 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 today

READMEChangelog (10)Dependencies (6)Versions (25)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

50

—

FairBetter than 95% of packages

Maintenance98

Actively maintained with recent releases

Popularity19

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 98% 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 ~43 days

Recently: every ~209 days

Total

23

Last Release

7d ago

Major Versions

v1.2.1 → v2.0.02024-02-09

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/100956614?v=4)[XRPLWin](/maintainers/xrplwin)[@XRPLWin](https://github.com/XRPLWin)

---

Top Contributors

[![zgrguric](https://avatars.githubusercontent.com/u/108837406?v=4)](https://github.com/zgrguric "zgrguric (50 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 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

[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

85036.3k](/packages/flow-php-flow)[composer-unused/symbol-parser

Toolkit to parse symbols from a composer package

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

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

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

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

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

PHP SDK / Client for the XRP Ledger

1110.7k7](/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.1k2](/packages/open-code-modeling-json-schema-to-php)

PHPackages © 2026

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