PHPackages                             phpvv/array-reflect - 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. phpvv/array-reflect

ActiveLibrary

phpvv/array-reflect
===================

A simple library to help modify and get content of arrays

0.1.2(4y ago)0134MITPHPPHP ^8.0

Since Mar 4Pushed 4y agoCompare

[ Source](https://github.com/phpvv/array-reflect)[ Packagist](https://packagist.org/packages/phpvv/array-reflect)[ RSS](/packages/phpvv-array-reflect/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependencies (2)Versions (4)Used By (0)

ArrayReflect
============

[](#arrayreflect)

A simple PHP library to help modify and get the contents of arrays

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

[](#installation)

Package is available on [Packagist](https://packagist.org/packages/phpvv/array-reflect), you can install it using [Composer](https://getcomposer.org).

```
composer require phpvv/array-reflect
```

Get array contents with type control
------------------------------------

[](#get-array-contents-with-type-control)

```
use VV\Net\Http\Request;
use VV\Net\Http\Response;
use App\Web\BadRequestException;

class Server implements \VV\Net\Http\Server {

    public function processHttpRequest(Request $request): Response {
        // ArrayReflect::cast($_POST)
        $request->post()->setGetterTypeExceptionClass(BadRequestException::class);

        try {
            return $this->route($request); // /foo/bar
        } catch (BadRequestException $e) {
            return (new Response)->badRequest($e->getMessage());
        }
    }
    .
    .
    .
}
```

```
use VV\Utils\ArrayReflect;
use VV\Net\Http\Response;

class FooController {

    function barAction(ArrayReflect $post): Response {
        // throws BadRequestException if value is "bad"
        $userId = $post->int('userId');         //  ok: 1, '2', '0003', null
                                                // bad: 1.1, '2foo', array, bool, object...
        $rating = $post->float('rating');       //  ok: 1, 2.3, '4.5', null
                                                // bad: '2foo', array, bool, object...
        $name = $post->string('name');          //  ok: 1, 2.3, '4', 'foo', null
                                                // bad: array, bool, object...
        $isAactive = $post->bool('isAactive');  //  ok: true, false, 0, 1, '', '0', '1', null
        $interests = $post->array('interests'); //  ok: ['1', 2, 'foo']
                                                // bad: 1, 'foo', bool, object...
        //$interests = $post->arrayReflect('interests'); // same as above but $interests instanceof ArrayReflect

        $items = $post->intIterator('items');     // [1, '2', '003']
        //$items = $post->floatIterator('items'); // [1, 2.3, '4.5']
        //$items = $post->boolIterator('items');  // [1, 2.3, '4', 'foo']
        //$items = $post->arrayIterator('items'); // [[1, 2.3, 'foo'], ['bar', true, ['sub']], ...]

        $votes = $post->arrayReflectIterator('votes');
        foreach ($votes as $vote) {
            $voteUserId = $vote->int('userId');
            $voteValue = $vote->int('value');
        }
        .
        .
        .

        return (new Response)->setContent('Ok');
    }
    .
    .
    .
}
```

Modify array contents by reference
----------------------------------

[](#modify-array-contents-by-reference)

```
use VV\Utils\ArrayReflect;

$sessionReflect = new ArrayReflect($_SESSION);
$storage = $sessionReflect->iref('my', 'concrete', 'path');

$storage->set('key1', 'val1');
$storage->push('val3', 'val4');
$storage->merge(['val5', 'key' => 'val']);

print_r($_SESSION);
// Array (
//   [my] => Array (
//     [concrete] => Array (
//       [path] => Array (
//         [key1] => val1
//         [0] => val3
//         [1] => val4
//         [2] => val5
//         [key] => val
//       )
//     )
//   )
// )
```

```
$sub = &$storage->ref('key', 'sub', 'namespace');
if ($sub === null) {
    $sub = 42;
}

print_r($_SESSION);
// Array (
//   [my] => Array (
//     [concrete] => Array (
//       [path] => Array (
//         [key1] => val1
//         [0] => val3
//         [1] => val4
//         [2] => val5
//         [key] => Array (
//           [sub] => Array (
//             [namespace] => 42
//           )
//         )
//       )
//     )
//   )
// )
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

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

Total

3

Last Release

1769d ago

### Community

Maintainers

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

---

Top Contributors

[![v00v4n](https://avatars.githubusercontent.com/u/75783029?v=4)](https://github.com/v00v4n "v00v4n (3 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/phpvv-array-reflect/health.svg)

```
[![Health](https://phpackages.com/badges/phpvv-array-reflect/health.svg)](https://phpackages.com/packages/phpvv-array-reflect)
```

PHPackages © 2026

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