PHPackages                             multidimensional/xml-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. multidimensional/xml-array

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

multidimensional/xml-array
==========================

Create an Array from a XML file.

1.0.0(7y ago)1110MITPHP &gt;=5.5

Since Feb 20Compare

[ Source](https://github.com/multidimension-al/xml-array)[ Packagist](https://packagist.org/packages/multidimensional/xml-array)[ RSS](/packages/multidimensional-xml-array/feed)WikiDiscussions Synced 3d ago

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

XML to PHP Array Converter
==========================

[](#xml-to-php-array-converter)

[![Build Status](https://camo.githubusercontent.com/112f3988e21ec3d27e2070c3f191d729f6d9aeff29e1dfcab42bab9cd0a103f0/68747470733a2f2f7472617669732d63692e6f72672f6d756c746964696d656e73696f6e2d616c2f786d6c2d61727261792e737667)](https://travis-ci.org/multidimension-al/xml-array)[![Latest Stable Version](https://camo.githubusercontent.com/86cae28a50e47da7c685cf06f8be77c889e1e39eca3bae407f469a66c0e86fd6/68747470733a2f2f706f7365722e707567782e6f72672f6d756c746964696d656e73696f6e616c2f786d6c2d61727261792f762f737461626c652e737667)](https://packagist.org/packages/multidimensional/xml-array)[![Code Coverage](https://camo.githubusercontent.com/b9a154a75be1b410746e4cb677264bed2e607bf85f2f9f2e3c87aec1f9d90561/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d756c746964696d656e73696f6e2d616c2f786d6c2d61727261792f6261646765732f636f7665726167652e706e67)](https://scrutinizer-ci.com/g/multidimension-al/xml-array/)[![Minimum PHP Version](https://camo.githubusercontent.com/dd6bad85ee03cf570f4cf82ab69a80396fdbf48050af932f8f23aa551b0d1e5a/687474703a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230352e352d3838393242462e737667)](https://php.net/)[![License](https://camo.githubusercontent.com/9d89d7ad8ee6c6839815a81d70427a7ec7db8f9a8f5b99fec4a6106b41857f5a/68747470733a2f2f706f7365722e707567782e6f72672f6d756c746964696d656e73696f6e616c2f786d6c2d61727261792f6c6963656e73652e737667)](https://packagist.org/packages/multidimensional/xml-array)[![Total Downloads](https://camo.githubusercontent.com/244f13e3d2713d3f7b08c9a2d50dd71a640a151fdc0d5d2a5e143fd15db01388/68747470733a2f2f706f7365722e707567782e6f72672f6d756c746964696d656e73696f6e616c2f786d6c2d61727261792f642f746f74616c2e737667)](https://packagist.org/packages/multidimensional/xml-array)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/a7b40ebd9feba14db22b020f89f56b89c3857b5741f3ea58cdcf96a95c483c2c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d756c746964696d656e73696f6e2d616c2f786d6c2d61727261792f6261646765732f7175616c6974792d73636f72652e706e67)](https://scrutinizer-ci.com/g/multidimension-al/xml-array/)

This is a very simple and basic library that will create a PHP Array from a well formatted XML input. This library does the opposite of our [DOM-Array](https://github.com/multidimension-al/dom-array) library which converts an array into an XML file.

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

[](#requirements)

- PHP 5.5+

Installation
============

[](#installation)

The easiest way to install this library is to use composer. To install, simply include the following in your `composer.json` file:

```
"require": {
    "multidimensional/xml-array": "*"
}

```

Or run the following command from a terminal or shell:

```
composer require --prefer-dist multidimensional/xml-array

```

You can also specify version constraints, with more information available [here](https://getcomposer.org/doc/articles/versions.md).

Usage
=====

[](#usage)

This library utilizes PSR-4 autoloading, so make sure you include the library near the top of your class file:

```
use Multidimensional\XmlArray\XMLArray;
```

How to use in your code:

```
$xml = 'Value';
$array = XMLArray::generateArray($xml);
print_r($array);

//$array = array("tag" => array(0 => 'Value'));
```

By default, the library will convert attributes and will prepend `@` prior to the name of the attribute. You can disable the conversion of attributes by setting the 2nd parameter in `generateArray` to false.

When set to false, the attributes will be placed in an array, typically marked by the value '@attributes'.

*Null* or *Empty* XML will return a null array.

Contributing
============

[](#contributing)

We appreciate all help in improving this library by either adding functions or improving existing functionality. If you do want to add to our library, please ensure you use PSR-2 formatting and add unit testing for all added functions.

Feel free to fork and submit a pull request!

License
=======

[](#license)

```
MIT License

Copyright (c) 2017 - 2019 multidimension.al

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

```

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity55

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

2688d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6588235?v=4)[AJ Quick](/maintainers/ajquick)[@ajquick](https://github.com/ajquick)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/multidimensional-xml-array/health.svg)

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

###  Alternatives

[alexwight/php-signalr-client

Signal R Client

2330.9k](/packages/alexwight-php-signalr-client)[aertmann/history

An improved history backend module for Neos

1073.3k](/packages/aertmann-history)[pixelfederation/circuit-breaker-bundle

An analogous bundle to Java's Hystrix in PHP world.

1228.2k](/packages/pixelfederation-circuit-breaker-bundle)

PHPackages © 2026

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