PHPackages                             tomhart/array-from-object - 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. tomhart/array-from-object

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

tomhart/array-from-object
=========================

Array From Object

v1.0.2(6y ago)067[1 PRs](https://github.com/TomHart/array-from-object/pulls)1MITPHPPHP ^7.2CI failing

Since Dec 10Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/TomHart/array-from-object)[ Packagist](https://packagist.org/packages/tomhart/array-from-object)[ Docs](https://github.com/)[ RSS](/packages/tomhart-array-from-object/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (3)Versions (5)Used By (1)

Array from object
=================

[](#array-from-object)

[![Build Status](https://camo.githubusercontent.com/338597cd9acd988607060f74f48647171b2a09cb7666cf072f6158a3b86e788a/68747470733a2f2f7472617669732d63692e636f6d2f546f6d486172742f61727261792d66726f6d2d6f626a6563742e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/TomHart/array-from-object)[![codecov](https://camo.githubusercontent.com/03823c894acdbabd0a9d7f3cf9730ac6dc9d446246f719a795cad36d75400ddd/68747470733a2f2f636f6465636f762e696f2f67682f546f6d486172742f61727261792d66726f6d2d6f626a6563742f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/TomHart/array-from-object)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/6f69043e5e716c07a209d9fafc337a6fe0b8a92150e61a679c6768d26045b23e/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f546f6d486172742f61727261792d66726f6d2d6f626a6563742f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/TomHart/array-from-object/?branch=master)[![GitHub release (latest by date)](https://camo.githubusercontent.com/4ce743a7962289addedd91016cdc886c3da47bc2dcfbeb30a0ae672af9307607/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f546f6d486172742f61727261792d66726f6d2d6f626a6563743f636f6c6f723d677265656e)](https://camo.githubusercontent.com/4ce743a7962289addedd91016cdc886c3da47bc2dcfbeb30a0ae672af9307607/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f546f6d486172742f61727261792d66726f6d2d6f626a6563743f636f6c6f723d677265656e)[![GitHub](https://camo.githubusercontent.com/07ee2eb2ee5cd6d801812422713646955b52698ec86d61ca95308fe1e6b01284/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f546f6d486172742f61727261792d66726f6d2d6f626a6563743f636f6c6f723d677265656e)](https://camo.githubusercontent.com/07ee2eb2ee5cd6d801812422713646955b52698ec86d61ca95308fe1e6b01284/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f546f6d486172742f61727261792d66726f6d2d6f626a6563743f636f6c6f723d677265656e)

This library allows you to populate an array, pulling properties and nested properties from an object.

### Usage

[](#usage)

Simple example:

```
$params = ['name', 'id'];

$class = new \stdClass();
$class->name = 'name';
$class->id = 1;

$data = ArrayUtil::populateArrayFromObject($params, $class);
// ['name' => 'name', 'id' => 1]
```

Nested example:

```
$params = ['name', 'id', 'extra->name'];

$class = new \stdClass();
$class->name = 'name';
$class->id = 1;

$class2 = new \stdClass();
$class2->name = 'name-2';
$class->extra = $class2;

$data = ArrayUtil::populateArrayFromObject($params, $class);
// ['name' => 'name', 'id' => 1, 'extra->name' => 'name-2']
```

Providing missing data example:

```
$params = ['name', 'id', 'extra'];

$class = new \stdClass();
$class->name = 'name';
$class->id = 1;

$data = ArrayUtil::populateArrayFromObject($params, $class, [
    'extra' => 'static'
]);
// ['name' => 'name', 'id' => 1, 'extra' => 'static']
```

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance49

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity56

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

Total

3

Last Release

2397d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1374434?v=4)[Tom Hart](/maintainers/TomHart)[@TomHart](https://github.com/TomHart)

---

Top Contributors

[![tom-hart-sky-uk](https://avatars.githubusercontent.com/u/219799917?v=4)](https://github.com/tom-hart-sky-uk "tom-hart-sky-uk (4 commits)")

---

Tags

arrayutilitybuildertomhart

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tomhart-array-from-object/health.svg)

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

###  Alternatives

[nette/utils

🛠 Nette Utils: lightweight utilities for string &amp; array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.

2.1k430.4M1.7k](/packages/nette-utils)[voku/arrayy

Array manipulation library for PHP, called Arrayy!

4915.7M18](/packages/voku-arrayy)[bocharsky-bw/arrayzy

A native PHP arrays easy manipulation library in OOP way.

38427.7k](/packages/bocharsky-bw-arrayzy)[phpcsstandards/phpcsutils

A suite of utility functions for use with PHP\_CodeSniffer

6340.1M95](/packages/phpcsstandards-phpcsutils)[brunoconte3/dev-utils

A complete PHP utility library for validating, formatting, comparing data, and more.

4026.6k](/packages/brunoconte3-dev-utils)

PHPackages © 2026

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