PHPackages                             sitnikovik/array-to-object-serializer - 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. sitnikovik/array-to-object-serializer

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

sitnikovik/array-to-object-serializer
=====================================

Tool to convert your class nested with anothers to associative array

v1.0.2(2y ago)014MITPHPPHP &gt;=7.3

Since Sep 11Pushed 2y ago1 watchersCompare

[ Source](https://github.com/sitnikovik/arrtobj)[ Packagist](https://packagist.org/packages/sitnikovik/array-to-object-serializer)[ RSS](/packages/sitnikovik-array-to-object-serializer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (4)Used By (0)

Array-to-object serializer
==========================

[](#array-to-object-serializer)

Tool to convert your class nested with others to associative array

How to use
----------

[](#how-to-use)

Just run:

```
// Array to convert
$array = [
    "name" => "csgo",
    'players' => [
        [
            "name" => "bonnie",
            "health" => 100,
            "weapon" => [
                "name" => "m4a1",
                "ammo" => 30,
            ],
        ],
        [
            "name" => "klyde",
            "health" => 100,
            "weapon" => [
                "name" => "ak47",
                "ammo" => 30,
            ],
        ],
    ],
];

// Convert array to object with one step
$object = \Sitnikovik\ArrayToObjectSerializer\ArrayToObject::serialize($array, "needed_class_name_with_namespace");
```

How to specify object
---------------------

[](#how-to-specify-object)

You have to create object with properties annotated with `@ToObject` for each property you want to convert.

> Note: You have to specify full class name with namespace in `@ToObject` annotation without `use` statement and `::class` syntax cause of current version is adapted for PHP 7.3 and higher.

```
use Sitnikovik\ArrayToObjectSerializer\ToObject;

class Game
{
    /**
     * @var string
     */
    public $name;

    /**
     * @var Player[]
     *
     * @ToObject(Sitnikovik\ArrayToObjectSerializer\Mock\Player)
     */
    public $players = [];
}
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

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

Total

3

Last Release

748d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/48ee705bc5f29fe3f1713d11211aabea6c610fa64457a6f25f70daadebe6a5e8?d=identicon)[sitnikovik](/maintainers/sitnikovik)

---

Top Contributors

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

---

Tags

arrayarray-manipulationsobjectserializertoobject

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sitnikovik-array-to-object-serializer/health.svg)

```
[![Health](https://phpackages.com/badges/sitnikovik-array-to-object-serializer/health.svg)](https://phpackages.com/packages/sitnikovik-array-to-object-serializer)
```

PHPackages © 2026

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