PHPackages                             pbxapi/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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. pbxapi/xml-to-array

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

pbxapi/xml-to-array
===================

Easily convert valid xml to a php array.

2.0.1(5y ago)073MITPHPPHP ~7.0|^8.0

Since Oct 17Pushed 5y agoCompare

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

READMEChangelogDependencies (1)Versions (4)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 Pbxapi\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

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity69

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

Total

3

Last Release

1933d ago

Major Versions

1.0.0 → 2.0.02021-01-31

PHP version history (2 changes)1.0.0PHP ~7.0

2.0.0PHP ~7.0|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/69055642?v=4)[pbxHQ](/maintainers/pbxhq)[@pbxhq](https://github.com/pbxhq)

---

Top Contributors

[![mtownsend5512](https://avatars.githubusercontent.com/u/4945553?v=4)](https://github.com/mtownsend5512 "mtownsend5512 (7 commits)")[![aaron-1pbx](https://avatars.githubusercontent.com/u/10770444?v=4)](https://github.com/aaron-1pbx "aaron-1pbx (2 commits)")

---

Tags

xmlconvertpbxapi

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M229](/packages/masterminds-html5)[jms/serializer

Library for (de-)serializing data of any complexity; supports XML, and JSON.

2.3k135.8M851](/packages/jms-serializer)[jms/metadata

Class/method/property metadata management in PHP

1.8k152.8M88](/packages/jms-metadata)[jms/serializer-bundle

Allows you to easily serialize, and deserialize data of any complexity

1.8k89.3M627](/packages/jms-serializer-bundle)[sabre/xml

sabre/xml is an XML library that you may not hate.

52832.2M131](/packages/sabre-xml)[presta/sitemap-bundle

A Symfony bundle that provides tools to build your application sitemap.

3929.4M28](/packages/presta-sitemap-bundle)

PHPackages © 2026

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