PHPackages                             reactphp-x/json - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. reactphp-x/json

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

reactphp-x/json
===============

v1.0.0(1y ago)020MITPHP

Since Aug 10Pushed 4mo agoCompare

[ Source](https://github.com/reactphp-x/json)[ Packagist](https://packagist.org/packages/reactphp-x/json)[ RSS](/packages/reactphp-x-json/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

reactphp-x/json
===============

[](#reactphp-xjson)

install
-------

[](#install)

```
composer require reactphp-x/json -vvv

```

Usage
-----

[](#usage)

```
require __DIR__ . "/vendor/autoload.php";

use ReactphpX\Json\Json;

$json = new Json();

$json->registerDataSource('post', [
    'id' => 1,
    'title' => 'first post',
]);
$json->registerDataSource('post1', function ($json, $config) {
    return [
        'id' => 2,
        'title' => 'second post',
    ];
});

$json->registerDataStructure('post', [
    'id' => ":id",
]);

$json->registerDataStructure('post1', function ($json, $config) {
    return [
        'title' => ":title",
    ];
});

// output : {"id":1,"title":"first post"}
echo json_encode($json->getJson([
    "_data_source" => "post",
])) . PHP_EOL;

// output : {"id":2,"title":"second post"}
echo json_encode($json->getJson([
    "_data_source" => "post1",
])) . PHP_EOL;

// output : {"id":1}
echo json_encode($json->getJson([
    "_data_source" => "post",
    "_data_structure" => [
        "id"=> ":id",
    ],
])) . PHP_EOL;

// output : {"id":1}
echo json_encode($json->getJson([
    "_data_source" => "post",
    "_data_structure" => "post",
])) . PHP_EOL;

// output : {"title":"second post"}
echo json_encode($json->getJson([
    "_data_source" => "post1",
    "_data_structure" => "post1",
])) . PHP_EOL;

// _data_option
$json->registerDataSource('test_option', function ($json, $config) {
    return $config['_data_option'] ?? [];
});

// output : {"id":"1","title":"my is title"}
echo json_encode($json->getJson([
    "_data_source" => "test_option",
    "_data_option"=> [
        "id"=> "1",
        "title"=> "my is title",
    ],
    "_data_structure" => ":*",
])) . PHP_EOL;
```

test
----

[](#test)

```
./vendor/bin/phpunit tests/

```

License
-------

[](#license)

MIT

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance57

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

647d ago

### Community

Maintainers

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

---

Top Contributors

[![wpjscc](https://avatars.githubusercontent.com/u/76907477?v=4)](https://github.com/wpjscc "wpjscc (6 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/reactphp-x-json/health.svg)

```
[![Health](https://phpackages.com/badges/reactphp-x-json/health.svg)](https://phpackages.com/packages/reactphp-x-json)
```

###  Alternatives

[runtime/react

ReactPHP runtime

185.3k1](/packages/runtime-react)

PHPackages © 2026

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