PHPackages                             webdevvie/nestis - 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. webdevvie/nestis

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

webdevvie/nestis
================

A simple php class that allows for the retrieval of nested object without null checks

2.0.2(3mo ago)010.7k↑25%2Apache-2.0PHPPHP ~7.4|~8.2

Since Jun 29Pushed 3mo ago1 watchersCompare

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

READMEChangelog (4)Dependencies (3)Versions (10)Used By (2)

Nestis
======

[](#nestis)

A simple class to get a nested property or array key from an array or nested property.

Why
---

[](#why)

Having gone through several weeks of is\_null($object) checks and not being able to reliably depend on the api's output I was using to always have the objects I decided this method needed to be made. Now I can do the following without the fear of running into a null or other random object that the api responds with:

```
public function getThatThingIWant($apiResponse)
{
    return $nestis->getNestedItem('someObject/someOtherProperty/itemIWant',$apiResponse);
}

```

instead of :

```
public function getThatThingIWant($apiResponse)
{
   $someObject = $apiResponse->getSomeObject();

   if(!is_null($someObject))
   {
        $someOtherProperty = $someObject->getSomeOtherProperty();
        if(!is_null($someOtherProperty))
        {
            return $someOtherProperty->getItemIWant();
        }
   }

   return null;
}

```

It works on arrays,objects,public properties, public methods,get{{propertyname}} and is{{propertyname}} and public static properties

Separator is / For static properties use ::{yourvarname} (e.g. testItem/::someStaticVar)

Also works great with json objects.

Using it in your project
------------------------

[](#using-it-in-your-project)

First add it to your project using composer

```
./composer require webdevvie/nestis

```

In your project use the class.

```
use Webdevvie\Nestis;

```

then try it out!

```

use Webdevvie\Nestis\Nestis;

$nested = (object)["test"=>(object)["layer1"=>['layer2'=>(object)['layer3'=>'downtherabbithole']]]];

print_r($nested);
$nestis = new Nestis();
$item = $nestis->getNestedItem('test/layer1/layer2',$nested,null);

print_r($item);

```

This will output:

```
stdClass Object
(
    [test] => stdClass Object
        (
            [layer1] => Array
                (
                    [layer2] => stdClass Object
                        (
                            [layer3] => downtherabbithole
                        )

                )

        )

)
stdClass Object
(
    [layer3] => downtherabbithole
)

```

Author
------

[](#author)

If you like this library. Find me on twitter [@webdevvie](http://twitter.com/webdevvie) or my personal site [johnbakker.name](http://johnbakker.name) and say hello

###  Health Score

53

—

FairBetter than 96% of packages

Maintenance81

Actively maintained with recent releases

Popularity23

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity81

Battle-tested with a long release history

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

Recently: every ~452 days

Total

9

Last Release

99d ago

Major Versions

1.2.0 → 2.0.02026-03-27

PHP version history (5 changes)1.0PHP &gt;=5.4.0

1.0.2PHP &gt;=5.6.0

1.2.0PHP &gt;=7.4|~8.0|~8.1|~8.2

2.0.0PHP ^8.2

2.0.2PHP ~7.4|~8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/974b672adc355278acd2c4df8b1d48f1ae264487994de24a007e10d5828f623b?d=identicon)[webdevvie](/maintainers/webdevvie)

---

Top Contributors

[![webdevvie](https://avatars.githubusercontent.com/u/6097722?v=4)](https://github.com/webdevvie "webdevvie (16 commits)")

---

Tags

nestedobjectbystring

###  Code Quality

TestsPHPUnit

Static AnalysisRector

### Embed Badge

![Health badge](/badges/webdevvie-nestis/health.svg)

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

###  Alternatives

[myclabs/deep-copy

Create deep copies (clones) of your objects

8.9k894.3M227](/packages/myclabs-deep-copy)[symfony/property-access

Provides functions to read and write from/to an object or array using a simple string notation

2.8k317.3M3.2k](/packages/symfony-property-access)[league/config

Define configuration arrays with strict schemas and access values with dot notation

565335.0M36](/packages/league-config)[cuyz/valinor

Dependency free PHP library that helps to map any input into a strongly-typed structure.

1.5k13.2M174](/packages/cuyz-valinor)[yassi/nova-nested-form

A Laravel Nova package that allows you to create/update/delete nested related fields from a parent form.

239507.0k](/packages/yassi-nova-nested-form)[kartik-v/yii2-tree-manager

An enhanced tree management module with tree node selection and manipulation using nested sets.

156552.1k15](/packages/kartik-v-yii2-tree-manager)

PHPackages © 2026

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