PHPackages                             jord-jd/object\_to\_array - 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. jord-jd/object\_to\_array

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

jord-jd/object\_to\_array
=========================

This PHP package provides an `object\_to\_array` helper function.

v3.0.0(3mo ago)331LGPL-3.0-onlyPHPPHP &gt;=7.1

Since Feb 12Pushed 3mo agoCompare

[ Source](https://github.com/Jord-JD/object_to_array)[ Packagist](https://packagist.org/packages/jord-jd/object_to_array)[ GitHub Sponsors](https://github.com/DivineOmega)[ RSS](/packages/jord-jd-object-to-array/feed)WikiDiscussions master Synced 1mo ago

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

`object_to_array` helper function
=================================

[](#object_to_array-helper-function)

[![Build Status](https://camo.githubusercontent.com/0720d8aa9c42810a5ce4503036efc08da3c354627477a346e54384ea693f8fe8/68747470733a2f2f7472617669732d63692e6f72672f4a6f72642d4a442f6f626a6563745f746f5f61727261792e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Jord-JD/object_to_array)[![Coverage Status](https://camo.githubusercontent.com/4a3a19e5cf8685194ae428141c6528197bbe38255afda5cb33c2c6ec85c6fd29/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f4a6f72642d4a442f6f626a6563745f746f5f61727261792f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/Jord-JD/object_to_array?branch=master)[![StyleCI](https://camo.githubusercontent.com/d2cf4867dffdf629d6b19584e5e672aca1b4d43702ba06b1162af08e3958e71c/68747470733a2f2f7374796c6563692e696f2f7265706f732f3132313236303530352f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/121260505)

This PHP package provides an `object_to_array` helper function. You can use this function to convert an object to an array.

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

[](#installation)

The `object_to_array` package can be easily installed using Composer. Just run the following command from the root of your project.

```
composer require "jord-jd/object_to_array"

```

If you have never used the Composer dependency manager before, head to the [Composer website](https://getcomposer.org/) for more information on how to get started.

Usage
-----

[](#usage)

Here are a few examples of how to use the `object_to_array` helper function.

```
// Basic object

$object = new stdClass;
$object->name = 'John';
$object->age = 32;

$array = object_to_array($object)

/*
$array = [
    'name' => 'John',
    'age' => 32
];
*/
```

```
// Object with nested object

$object = new stdClass;
$object->name = 'John';
$object->age = 32;
$object->pet = new stdClass;
$object->pet->type = 'cat';
$object->pet->name = 'Mr Fluffkins The Third';

$array = object_to_array($object)

/*
$array = [
    'name' => 'John',
    'age' => 32,
    'pet' => [
        'name' => 'Mr Fluffkins The Third',
        'type' => 'cat'
    ]
];
*/
```

```
// Object with nested array

$object = new stdClass;
$object->name = 'John';
$object->age = 32;
$object->favouriteFoods = [
    'pizza',
    'cake'
];

$array = object_to_array($object)

/*
$array = [
    'name' => 'John',
    'age' => 32,
    'favouriteFoods' => [
        'pizza',
        'cake'
    ]
];
*/
```

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance82

Actively maintained with recent releases

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 85.7% 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 ~1462 days

Total

3

Last Release

93d ago

Major Versions

v1.0.0 → v2.0.02026-02-14

v2.0.0 → v3.0.02026-02-14

### Community

Maintainers

![](https://www.gravatar.com/avatar/c580cdf7c14898fff179cdfc1085892091d5d2f49d917873a12365af9ac77c93?d=identicon)[Jord-JD](/maintainers/Jord-JD)

---

Top Contributors

[![Jord-JD](https://avatars.githubusercontent.com/u/650645?v=4)](https://github.com/Jord-JD "Jord-JD (6 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")

---

Tags

arrayhelper-functionsobjectphpphp-library

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[components/mathjs

Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with different data types like numbers, big numbers, complex numbers, fractions, units, and matrices.

15.0k3.8k](/packages/components-mathjs)[aura/payload-interface

An interface package for Domain Payload implementations.

13392.7k4](/packages/aura-payload-interface)

PHPackages © 2026

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