PHPackages                             lukasros/json-include - 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. lukasros/json-include

ActiveLibrary

lukasros/json-include
=====================

Combine JSON data from multiple files.

010PHP

Since Aug 19Pushed 11y ago1 watchersCompare

[ Source](https://github.com/LukasRos/JSONInclude-PHP)[ Packagist](https://packagist.org/packages/lukasros/json-include)[ RSS](/packages/lukasros-json-include/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

JSONInclude-PHP
===============

[](#jsoninclude-php)

What is JSONInclude?
--------------------

[](#what-is-jsoninclude)

XML has [XInclude](http://www.w3.org/TR/xinclude/) which allows to combine XML from different files into one. There is no generic equivalent for JSON that I am aware of, so I came up with a simple idea for it. I believe having this can be useful if we want to dynamically combine JSON output, e.g. in an API, from different static files without duplicating information in those files.

Let's explain it with an example ... assume we have one file:

```
{
 "key1" : "value1",
 "key2" : "@file2.txt"
}

```

The "@" is an include symbol which indicates the string behind it should be treated as the filename for inclusion. The content of the second file is this:

```
{
 "key1" : "value2"
}

```

Loading the first file with a JSONInclude parser would return the following output:

```
{
 "key1" : "value1",
 "key2" : {
  "key1" : "value2"
 }
}

```

The include symbol can also be changed in case a leading "@" is used for a different purpose.

What is JSONInclude-PHP?
------------------------

[](#what-is-jsoninclude-php)

A simple parser for JSONInclude as a reference implementation written in PHP. It also supports parsing JSON files with comments and generic preprocessing of JSON data.

How can I use it?
-----------------

[](#how-can-i-use-it)

1. Add `"lukasros/json-include": "dev-master"` to the composer.json file for your project.
2. Install/update dependencies with composer.
3. Initialize an instance in your code: `$jsonInclude = new LukasRos\JSONInclude\JSONInclude();`
4. Load and parse a JSON file: `$parsedJson = $jsonInclude->parseFileWithIncludes('filename.json');`

Please check the `demo` folder for an example.

Who's behind it?
----------------

[](#whos-behind-it)

JSONInclude-PHP was created by Lukas Rosenstock. Contact me through my website at [lukasrosenstock.net](http://lukasrosenstock.net/).

Terms
-----

[](#terms)

This software is released under the MPL - see LICENSE file for details.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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.

### Community

Maintainers

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

---

Top Contributors

[![LukasRos](https://avatars.githubusercontent.com/u/192050?v=4)](https://github.com/LukasRos "LukasRos (10 commits)")

### Embed Badge

![Health badge](/badges/lukasros-json-include/health.svg)

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

PHPackages © 2026

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