PHPackages                             legalthings/data-enricher - 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. legalthings/data-enricher

ActiveLibrary

legalthings/data-enricher
=========================

Enrich objects by processing special properties

v0.8.3(5y ago)33.3k↓66.7%1[3 issues](https://github.com/legalthings/data-enricher/issues)MITPHPPHP &gt;=5.5.0CI failing

Since Aug 14Pushed 5y ago10 watchersCompare

[ Source](https://github.com/legalthings/data-enricher)[ Packagist](https://packagist.org/packages/legalthings/data-enricher)[ RSS](/packages/legalthings-data-enricher/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)Dependencies (7)Versions (42)Used By (0)

Data enricher
=============

[](#data-enricher)

[![Build Status](https://camo.githubusercontent.com/bc5b5c07a3b02151e6b22dd4f27c3041a7219f8e8578272c33e47f9ee55a9890/68747470733a2f2f7472617669732d63692e6f72672f6c6567616c7468696e67732f646174612d656e7269636865722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/legalthings/data-enricher)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/c17f9c74e8fa96f49f89c1c2c697b1bf9f83743449f80882aa4d014db4176e90/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6c6567616c7468696e67732f646174612d656e7269636865722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/legalthings/data-enricher/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/a66bc1076f38e0683570f01a6211e04cffeaa656bc714c4dcf101546138ada77/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6c6567616c7468696e67732f646174612d656e7269636865722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/legalthings/data-enricher/?branch=master)

Enrich objects by processing special properties known as data instruction.

- `` - Resolve a reference to another part of the document using a dot key path
- `` - Checks if a reference is null. If so, replace the object by null.
- `` - Choose one of the child properties based on a property in the document
- `` - Load an external resource (through HTTP)
- `` - Merge a set of objects
- `` - Enrich an object with extra data by matching properties
- `` - Parse text as [Mustache](https://mustache.github.io/) template
- `` - Transform the input using a function. The following functions are available You can pass in a string with the following format `:`Alternatively you can pass in an object to pass multiple args `{ function: , args: [...] }`
    - [`hash:algo`](http://php.net/hash) - Replace `algo` with the algoritm
    - [`hash_hmac`](http://php.net/hash_hmac)
    - [`base64_encode`](http://php.net/base64_encode)
    - [`base64_decode`](http://php.net/base64_decode)
    - [`json_encode`](http://php.net/json_encode)
    - [`json_decode`](http://php.net/json_decode)
    - [`serialize`](http://php.net/serialize)
    - [`unserialize`](http://php.net/unserialize)
    - [`strtotime`](http://php.net/strtotime)
    - [`date`](http://php.net/date)
    - `public_encrypt`
    - `private_encrypt`
    - `private_decrypt`
    - `generate_private_key`
    - `generate_public_key`
    - `generate_signature`
    - `verify_signature`
- `` - Project an object using the [JMESPath](http://jmespath.org/) query language
- `` - Takes a date and a format (defaults to `Y-m-d`) and formats the accordingly. Optionally you can set the timezone if you wish to output timezone information.

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

[](#installation)

```
composer require legalthings/data-enricher

```

Usage
-----

[](#usage)

#### Source

[](#source)

```
{
  "foo": {
    "bar": {
      "qux": 12345,
    },
    "term": "data enrichment",
    "city": "Amsterdam",
    "country": "Netherlands"
  },
  "amount": {
    "" : "foo.bar.qux"
  },
  "message": {
    "": "I want to go to {{ foo.city }}, {{ foo.country }}"
  },
  "shipping": {
    "": "foo.country",
    "USA": "UPS",
    "Netherlands": "PostNL",
    "_other": "DHL"
  },
  "user" : {
    "": "https://api.example.com/users/9870"
  },
  "search_results": {
    "": {
      "": "http://api.duckduckgo.com/?q={{ foo.term }}&format=json"
    },
    "": "RelatedTopics[].{url: FirstURL, description: Text}"
  },
  "profile": {
    "": [
      { "": "foo.bar" },
      { "": "https://api.example.com/zoo/99" },
      {
        "apples": 100,
        "pears": 220
      }
    ]
  }
}
```

#### PHP script

[](#php-script)

```
$json = file_get_contents('source.json');
$object = json_decode($json);

$enricher = new DataEnricher();
$enricher->applyTo($object);

echo json_encode($object, JSON_PRETTY_PRINT);
```

#### Result

[](#result)

```
{
  "foo": {
    "bar": {
      "qux": 12345,
    },
    "term": "data enrichment",
    "city": "Amsterdam",
    "country": "Netherlands"
  },
  "amount": 12345,
  "message": "I want to go to Amsterdam, Netherlands",
  "shipping": "PostNL",
  "user" : {
    "id": "9870",
    "name": "John Doe",
    "email": "john@example.com"
  },
  "search_results": [
    {
      "url": "https://duckduckgo.com/Names_Database",
      "description": "Names Database - The Names Database is a partially defunct social network, owned and operated by Classmates.com, a wholly owned subsidiary of United Online. The site does not appear to be significantly updated since 2008, and has many broken links and display issues."
    },
    {
      "url": "https://duckduckgo.com/c/Tor_hidden_services",
      "description": "Tor hidden services"
    },
    {
      "url": "https://duckduckgo.com/c/Internet_privacy_software",
      "description": "Internet privacy software"
    }
  ],
  "profile": {
    "qux": 12345,
    "zoop": "P99",
    "zooq": "Q99",
    "apples": 100,
    "pears": 220
  }
}
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~0 days

Total

30

Last Release

2026d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3379a93d51305df325df9045e1a8b205d195e4e8c01312dff53a000ee79002eb?d=identicon)[jasny](/maintainers/jasny)

![](https://www.gravatar.com/avatar/fb23c3d3e3cfed7ef09c08be522314ed8f4aee9d25c0674ca3b0be7895182f8f?d=identicon)[svenstam](/maintainers/svenstam)

---

Top Contributors

[![jasny](https://avatars.githubusercontent.com/u/100821?v=4)](https://github.com/jasny "jasny (37 commits)")[![svenstm](https://avatars.githubusercontent.com/u/1632578?v=4)](https://github.com/svenstm "svenstm (26 commits)")[![moesjarraf](https://avatars.githubusercontent.com/u/5793511?v=4)](https://github.com/moesjarraf "moesjarraf (19 commits)")[![Minstel](https://avatars.githubusercontent.com/u/6154708?v=4)](https://github.com/Minstel "Minstel (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/legalthings-data-enricher/health.svg)

```
[![Health](https://phpackages.com/badges/legalthings-data-enricher/health.svg)](https://phpackages.com/packages/legalthings-data-enricher)
```

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.2k511.3M2.2k](/packages/aws-aws-sdk-php)[kreait/firebase-php

Firebase Admin SDK

2.4k39.7M72](/packages/kreait-firebase-php)[magento/magento2-functional-testing-framework

Magento2 Functional Testing Framework

15511.5M30](/packages/magento-magento2-functional-testing-framework)[neuron-core/neuron-ai

The PHP Agentic Framework.

1.8k245.3k21](/packages/neuron-core-neuron-ai)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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