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

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

mymediamagnet/xml-to-array
==========================

Easily convert valid xml to a php array.

v1.0.1(5y ago)012MITPHPPHP ~7.0|~8.0

Since Oct 17Pushed 5y agoCompare

[ Source](https://github.com/MyMediaMagnet/xml-to-array)[ Packagist](https://packagist.org/packages/mymediamagnet/xml-to-array)[ RSS](/packages/mymediamagnet-xml-to-array/feed)WikiDiscussions master Synced 1w ago

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

Easily convert valid xml to a php array.

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

[](#installation)

Install via composer:

```
composer require mtownsend/xml-to-array

```

Quick start
-----------

[](#quick-start)

### Using the class

[](#using-the-class)

```
use Mtownsend\XmlToArray\XmlToArray;

$xml =  'fedex',
	'id' => '123',
	'tracking_number' => '9205590164917312751089'
];
```

### Using the global helper

[](#using-the-global-helper)

```
$xml =  'fedex',
	'id' => '123',
	'tracking_number' => '9205590164917312751089'
];
```

Helpers, methods, and arguments
-------------------------------

[](#helpers-methods-and-arguments)

**Static method**

`XmlToArray::convert($xml, $outputRoot = false)`

The `$outputRoot` determines whether or not the php array will have a `@root` key. Default is `false`.

**Helper**

`xml_to_array($xml, $outputRoot = false)`

Arguments are identical to `XmlToArray::convert` method.

Purpose
-------

[](#purpose)

XML has always been a challenge to work with in PHP compared to other data formats, such as JSON. This package aims to make integrating with XML files or api requests significantly easier. With this package, you might actually like interfacing with XML in your application now.

Other packages you may be interested in
---------------------------------------

[](#other-packages-you-may-be-interested-in)

- [mtownsend/collection-xml](https://github.com/mtownsend5512/collection-xml)
- [mtownsend/request-xml](https://github.com/mtownsend5512/request-xml)
- [mtownsend/response-xml](https://github.com/mtownsend5512/response-xml)

Credits
-------

[](#credits)

- Mark Townsend
- Adrien aka Gaarf
- [All Contributors](../../contributors)

Testing
-------

[](#testing)

You can run the tests with:

```
./vendor/bin/phpunit
```

License
-------

[](#license)

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

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 77.8% 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 ~800 days

Total

2

Last Release

1969d ago

PHP version history (2 changes)1.0.0PHP ~7.0

v1.0.1PHP ~7.0|~8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/92a303d3fa2517fc0ec5cf790760659e39ab718cb3e1dcf042aea9e09dada0df?d=identicon)[DeveloperPlus](/maintainers/DeveloperPlus)

---

Top Contributors

[![mtownsend5512](https://avatars.githubusercontent.com/u/4945553?v=4)](https://github.com/mtownsend5512 "mtownsend5512 (7 commits)")[![MyMediaMagnet](https://avatars.githubusercontent.com/u/957497?v=4)](https://github.com/MyMediaMagnet "MyMediaMagnet (2 commits)")

---

Tags

laravelxmlarrayconvert

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[mtownsend/xml-to-array

Easily convert valid xml to a php array.

1163.5M21](/packages/mtownsend-xml-to-array)[clearstream/xml-to-array

Incredibly simple XML to array PHP converter

6736.7k](/packages/clearstream-xml-to-array)

PHPackages © 2026

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