PHPackages                             kristofferhagen/simplexml2flatarray - 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. kristofferhagen/simplexml2flatarray

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

kristofferhagen/simplexml2flatarray
===================================

Converts an XML document to several flat arrays containing values from parent elements using SimpleXML

2.0.0(12y ago)024MITPHPPHP &gt;=5.3.3

Since Jan 5Pushed 12y ago1 watchersCompare

[ Source](https://github.com/kristofferhagen/SimpleXML2FlatArray)[ Packagist](https://packagist.org/packages/kristofferhagen/simplexml2flatarray)[ Docs](https://github.com/kristofferhagen/SimpleXML2FlatArray)[ RSS](/packages/kristofferhagen-simplexml2flatarray/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (2)Used By (0)

SimpleXML2FlatArray
===================

[](#simplexml2flatarray)

Converts an XML document to several flat arrays containing values from parent elements using SimpleXML.

Useful for storing xml data in a database.

Usage
-----

[](#usage)

First of all, you need to create a SimpleXML object. You can do this in one of several ways:

```
// Load from file
$simplexml = simplexml_load_file('data.xml');

// Load from string
$simplexml = simplexml_load_string($xml_string);
```

It is also possible to load from a DOM node. For more information on creating a SimpleXML object, see [this documentation page](http://www.php.net/manual/en/ref.simplexml.php).

The following code reads the `$simplexml` object created above into a flat array `$data`:

```
$xml = new SimpleXML2FlatArray($simplexml);

$data = $xml->get();
```

You can aslo iterate over the SimpleXML2FlatArray object, as shown below:

```
foreach ($xml as $v) {
    // $v is a key => value pair of values parsed from the xml
    var_dump($v);
}
```

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

4559d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1660629?v=4)[Kristoffer Hagen](/maintainers/kristofferhagen)[@kristofferhagen](https://github.com/kristofferhagen)

---

Top Contributors

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

---

Tags

convertSimpleXMLflat array

### Embed Badge

![Health badge](/badges/kristofferhagen-simplexml2flatarray/health.svg)

```
[![Health](https://phpackages.com/badges/kristofferhagen-simplexml2flatarray/health.svg)](https://phpackages.com/packages/kristofferhagen-simplexml2flatarray)
```

###  Alternatives

[akaunting/laravel-money

Currency formatting and conversion package for Laravel

7855.7M46](/packages/akaunting-laravel-money)[iamcal/php-emoji

This is a PHP library for dealing with Emoji, allowing you to convert between various native formats and displaying them using HTML.

1.3k528.3k](/packages/iamcal-php-emoji)[gabrielelana/byte-units

Library to parse, format and convert byte units

1682.3M20](/packages/gabrielelana-byte-units)[khill/php-duration

Converts between colon formatted time, human-readable time and seconds

1571.8M20](/packages/khill-php-duration)[misd/linkify

Converts URLs and email addresses in text into HTML links

1123.1M11](/packages/misd-linkify)[ssnepenthe/color-utils

A PHP library for performing SASS-like color manipulations.

631.2M16](/packages/ssnepenthe-color-utils)

PHPackages © 2026

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