PHPackages                             incraigulous/objection - 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. incraigulous/objection

ActiveLibrary

incraigulous/objection
======================

Wrap nested arrays in DTO objects and collections.

1.1.0(3y ago)64661MITPHP

Since Jan 9Pushed 3y ago1 watchersCompare

[ Source](https://github.com/incraigulous/objection)[ Packagist](https://packagist.org/packages/incraigulous/objection)[ RSS](/packages/incraigulous-objection/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (2)Dependencies (3)Versions (6)Used By (1)

Objection
---------

[](#objection)

Recursively wrap nested arrays in Laravel-style DTO objects and collections. Just pass in your array and **BLAMO**, you'll get a nested DTO objects and collections back.

### Why?

[](#why)

I like accessing data in my views using a fluent object syntax instead of array syntax.

##### How to use it:

[](#how-to-use-it)

```
  $data = objection(
    [
        [
            'test' => 'asdf',
            'test2' => [
                'sub' => 'asdasdffasdf',
                'sub2' => 'teasdasdffasdfst',
            ],
        ],
        [
            'test' => 'asdasdffasdf',
            'test2' => 'teasdasdffasdfst',
        ]
    ]
  )

  echo $data->first()->test2->sub2; //teasdasdffasdfst

```

##### Convert it back to an array:

[](#convert-it-back-to-an-array)

```
  $data->toArray();

```

##### What if I don't like using helper functions?

[](#what-if-i-dont-like-using-helper-functions)

```
  return \Incraigulous\Objection\ObjectionFactory::make($array);

```

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

[](#installation)

```
  composer require incraigulous/objection

```

Credits
-------

[](#credits)

- DTO Objects:
- Collections:

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity64

Established project with proven stability

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

Total

5

Last Release

1119d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8881ef19db4ab59a70646ca205921b6e68badc9d5fdb6dfbb9b2b33db30af2ad?d=identicon)[incraigulous](/maintainers/incraigulous)

---

Top Contributors

[![incraigulous](https://avatars.githubusercontent.com/u/5910297?v=4)](https://github.com/incraigulous "incraigulous (11 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/incraigulous-objection/health.svg)

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

###  Alternatives

[schulzefelix/laravel-adwords-targeting-idea-service

Laravel wrapper for the AdWords Targeting Idea Service

272.4k](/packages/schulzefelix-laravel-adwords-targeting-idea-service)

PHPackages © 2026

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