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

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

eventjet/json
=============

Type-safe JSON encoding and decoding

v0.1.3(1mo ago)052.5k↓27.5%[2 PRs](https://github.com/eventjet/eventjet-json/pulls)1MITPHPPHP &gt;=8.3

Since Jan 24Pushed 2mo ago2 watchersCompare

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

READMEChangelog (3)Dependencies (20)Versions (9)Used By (1)

eventjet/json
=============

[](#eventjetjson)

Type-safe JSON parsing and encoding for PHP.

While PHP's native `json_parse()` outputs plain arrays or stdClass objects, this library allows you to decode JSON into pre-defined classes. This allows you to use type-hints and IDE autocompletion for your JSON data.

`eventjet/json` is loosely based how JSON in handled in Go's [`encoding/json`](https://pkg.go.dev/encoding/json) package.

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

[](#installation)

```
composer require eventjet/json
```

Usage
-----

[](#usage)

```
use Eventjet\Json\Json;

enum Status: string {
    case Active = 'active';
    case Inactive = 'inactive';
}

final readonly class User
{
    /**
     * @param list $friends
     */
    public function __construct(
        public string $name,
        public Status $status,
        public array $friends,
        public string|null $email = null,
    ) {}
}

$json = '
    {
        "name": "John",
        "status": "active",
        "friends": [
            {"name": "Jane", "status": "inactive", "friends": []}
        ]
    }
';
$user = Json::decode($json, User::class);

echo $user->name; // John
echo $user->status; // Status::Active
echo $user->friends[0]->name; // Jane
echo $user->friends[0]->status; // Status::Inactive
```

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance86

Actively maintained with recent releases

Popularity31

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity56

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.

###  Release Activity

Cadence

Every ~289 days

Total

5

Last Release

54d ago

PHP version history (3 changes)v0.1.0PHP &gt;=8.1

0.2.x-devPHP &gt;=8.2

v0.1.3PHP &gt;=8.3

### Community

Maintainers

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

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[ammardaana/laravel-domain-driven-design

Generate laravel Domain driven design (monolith) structure

111.2k](/packages/ammardaana-laravel-domain-driven-design)

PHPackages © 2026

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