PHPackages                             adhocore/get-in - 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. adhocore/get-in

AbandonedArchivedLibrary

adhocore/get-in
===============

Handy Traversal of chained objects with error trap and default value (suited for View).

913PHP

Since Aug 5Pushed 7y ago1 watchersCompare

[ Source](https://github.com/adhocore/get-in)[ Packagist](https://packagist.org/packages/adhocore/get-in)[ RSS](/packages/adhocore-get-in/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

about
-----

[](#about)

this prevents php error "Call to a member function on a non-object" and provides elegant syntax to access the methods of chained object in a fluent way and also has default value for if it should fail at any point

rationale and usage
-------------------

[](#rationale-and-usage)

for something like:

```
echo $user->getGroup()->getPermission()->getName();
```

this scenario is not uncommon in any ORM. now, in case `$user` is `null` or `$user->getGroup()` is `null` or etc, it can be hell of a checks like:

```
$default = 'some name';
if ($user) {
    $group = $user->getGroup();
    if ($group) {
        $permission = $group->getPermission();
        if ($permission){
            echo $permission->getName();
        } else {
            echo $default;
        }
    } else {
        echo $default;
    }
} else {
    echo $default;
}
```

or it can be quite shorter in another smart way like:

```
$default = 'some name';
if ($user and
    $group = $user->getGroup() and
    $permission = $group->getPermission()
) {
    echo $permission->getName();
} else {
    echo $default;
}
```

still not perfect. `adhocore/get-in` saves one from this PITA by providing handy wrapper like:

```
echo \Ahc\Get::in($user, 'getGroup.getPermission.getName', 'some name');
```

installation
------------

[](#installation)

edit your `composer.json` to include `"adhocore/get-in": "1.0.*@dev"` in the `require` section and run `composer update`

advantage
---------

[](#advantage)

- prevents multi layer check
- prevents errors like "Call to a member function on a non-object"
- saves from temporary variable creation during the checks
- provides a way to have default value should it fail at any point

the name
========

[](#the-name)

the name get-in is based on `igorw/get-in` which is similar thing for array manipulation, `adhocore/get-in` being for chained objects

###  Health Score

22

—

LowBetter than 23% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90.9% 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://avatars.githubusercontent.com/u/2908547?v=4)[Jitendra Adhikari](/maintainers/adhocore)[@adhocore](https://github.com/adhocore)

---

Top Contributors

[![adhocore](https://avatars.githubusercontent.com/u/2908547?v=4)](https://github.com/adhocore "adhocore (10 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")

---

Tags

adhocorechained-objectsget-inhandy-shortcutsphpprevent-errorssafe-retrieval

### Embed Badge

![Health badge](/badges/adhocore-get-in/health.svg)

```
[![Health](https://phpackages.com/badges/adhocore-get-in/health.svg)](https://phpackages.com/packages/adhocore-get-in)
```

PHPackages © 2026

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