PHPackages                             cosmin-ciolacu/simple-xml-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. cosmin-ciolacu/simple-xml-to-array

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

cosmin-ciolacu/simple-xml-to-array
==================================

Simple to use xml to php array converter

1.1.2(1y ago)112MITPHPPHP &gt;=7.0

Since Jul 11Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Cosmin-Ciolacu/simple-xml-to-array)[ Packagist](https://packagist.org/packages/cosmin-ciolacu/simple-xml-to-array)[ RSS](/packages/cosmin-ciolacu-simple-xml-to-array/feed)WikiDiscussions main Synced 1mo ago

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

Simple XML to Array PHP Package
===============================

[](#simple-xml-to-array-php-package)

This package provides a simple and efficient way to convert XML data to a PHP array.

Requirements
------------

[](#requirements)

- PHP 7.0 or higher

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

[](#installation)

You can install the package via Composer:

```
composer require cosmin-ciolacu/simple-xml-to-array
```

Usage
-----

[](#usage)

```
use CosminCiolacu\SimpleXmlToArray\SimpleXmlToArray;

$xml = 'value';

$array = SimpleXmlToArray::convert($xml);

print_r($array);
```

if the XML data is invalid it will throw an InvalidxmlException.

```
use CosminCiolacu\SimpleXmlToArray\Exceptions\InvalidXmlException;
use CosminCiolacu\SimpleXmlToArray\SimpleXmlToArray;

$invalidXml = 'value';

try {
    $array = SimpleXmlToArray::convert($invalidXml);
} catch (InvalidXmlException $e) {
    echo $e->getMessage();
}
```

it could also be used with a file path

```
use CosminCiolacu\SimpleXmlToArray\SimpleXmlToArray;
use CosminCiolacu\SimpleXmlToArray\Exceptions\InvalidXmlException;

try {
    $xmlFile = 'path/to/file.xml';
    $data = SimpleXmlToArray::convert($xmlFile, "file");

    print_r($data);
} catch (InvalidXmlException $e) {
    echo $e->getMessage();
}
```

Testing
-------

[](#testing)

```
./vendor/bin/pest
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

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

Total

3

Last Release

663d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9890402abd7b2eda674d1e8467b251c3cbaec8b10276ffdc1b1376bf011e9f39?d=identicon)[Ciolacu Cosmin](/maintainers/Ciolacu%20Cosmin)

---

Top Contributors

[![Cosmin-Ciolacu](https://avatars.githubusercontent.com/u/37322408?v=4)](https://github.com/Cosmin-Ciolacu "Cosmin-Ciolacu (8 commits)")

---

Tags

xmlarraySimpleXML

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/cosmin-ciolacu-simple-xml-to-array/health.svg)

```
[![Health](https://phpackages.com/badges/cosmin-ciolacu-simple-xml-to-array/health.svg)](https://phpackages.com/packages/cosmin-ciolacu-simple-xml-to-array)
```

###  Alternatives

[openlss/lib-array2xml

Array2XML conversion library credit to lalit.org

31052.5M47](/packages/openlss-lib-array2xml)[digitickets/lalit

GitHub copy of LaLit's XML2Array and Array2XML

721.3M6](/packages/digitickets-lalit)[hiraku/xml_builder

Simple DSL for building XML

141.6k1](/packages/hiraku-xml-builder)

PHPackages © 2026

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