PHPackages                             giann/trunk - 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. giann/trunk

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

giann/trunk
===========

A safe way to query data from a PHP array inspired by SwiftyJSON

1.5.2(1y ago)463.0k1MITPHPPHP &gt;=7.4

Since Apr 29Pushed 1y ago1 watchersCompare

[ Source](https://github.com/giann/trunk)[ Packagist](https://packagist.org/packages/giann/trunk)[ RSS](/packages/giann-trunk/feed)WikiDiscussions main Synced 3w ago

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

Trunk
=====

[](#trunk)

A safe way to query data from a PHP array inspired by SwiftyJSON

```
$trunk = new Trunk($data);

$this->assertTrue($trunk['astring'] instanceof Trunk);
$this->assertEquals($trunk['astring']->string(), 'hello world');

$this->assertEquals($trunk['anint']->int(), 12);

$this->assertEquals($trunk['alist']->listValue()[3]->string(), 'hello');

$this->assertEquals($trunk['amap']['hello']->string(), 'world');

$this->assertEquals($trunk['amap']['hello']['doesnexists']->data, null);

$this->assertTrue($trunk['anobject']->ofClass(Person::class) instanceof Person);
$this->assertEquals($trunk['anobject']->ofClass(Person::class)->name, 'joe');

$this->assertTrue($trunk['listofobject']->listOfClass(Person::class)[0] instanceof Person);
$this->assertEquals($trunk['listofobject']->listOfClass(Person::class)[0]->name, 'joe');

$this->assertTrue($trunk['mapofobject']->mapOfClass(Person::class)['joe'] instanceof Person);
$this->assertEquals($trunk['mapofobject']->mapOfClass(Person::class)['joe']->name, 'joe');

$this->assertTrue(
    $trunk['transformlist']
        ->listOfClass(
            Person::class,
            fn ($el) => new Person($el)
        )[0] instanceof Person
);

$this->assertTrue(
    $trunk['transformmap']
        ->mapOfClass(
            Person::class,
            fn ($el) => new Person($el)
        )['joe'] instanceof Person
);
```

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity55

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

Recently: every ~199 days

Total

10

Last Release

672d ago

PHP version history (2 changes)1.0.0PHP &gt;=8.1

1.0.1PHP &gt;=7.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/584398?v=4)[Benoit Giannangeli](/maintainers/giann)[@giann](https://github.com/giann)

---

Top Contributors

[![giann](https://avatars.githubusercontent.com/u/584398?v=4)](https://github.com/giann "giann (14 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/giann-trunk/health.svg)

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

PHPackages © 2026

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