PHPackages                             pn/epp-xml2array - 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. pn/epp-xml2array

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

pn/epp-xml2array
================

XML/EPP to a simple readable array, including Namespace and CDATA support

97.0k1[1 PRs](https://github.com/PeterNotenboom/EppXml-2-Array/pulls)PHP

Since Nov 14Pushed 6y ago3 watchersCompare

[ Source](https://github.com/PeterNotenboom/EppXml-2-Array)[ Packagist](https://packagist.org/packages/pn/epp-xml2array)[ RSS](/packages/pn-epp-xml2array/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

EppXml-2-Array v1.4
===================

[](#eppxml-2-array-v14)

An EPP ([http://en.wikipedia.org/wiki/Extensible\_Provisioning\_Protocol](http://en.wikipedia.org/wiki/Extensible_Provisioning_Protocol)), with Namespace support, to a simple Array. Still usable for normal XML too. CDATA is supported.

Why not use xyz?
----------------

[](#why-not-use-xyz)

For regular XML you can use this (probably) fine:

```
$xml = simplexml_load_string($xmlstring);
$json = json_encode($xml);
$array = json_decode($json,TRUE);
```

But it doesn't work "out of the box" with namespaces. Also, simplexml\_load\_string somehow removes certain attributes. For example, if your EPP had:

```
P-ABC120
```

It will remove the "type" attribute. And for EPP any missing information makes those methods unusable.

How to use
----------

[](#how-to-use)

First, load the XML:

```
PN\Xml2Array::loadXML($xml_string);
//or
PN\Xml2Array::loadXML(file_get_contents('somefile.xml'));
```

Get the whole array from your complete EPP string:

```
print_r( PN\Xml2Array::getArray() );
```

Get all the Namespace prefixes + URI's as an array:

```
print_r( PN\Xml2Array::getNamespaces() );
```

Get a part of the EPP in array by giving the prefix:

```
print_r( PN\Xml2Array::getArrayNS('contact') );
```

##### Added in v1.1

[](#added-in-v11)

Too lazy to look where in the array/xml a tag is? Or the tag could be changing in different xml files? See example1.php, use it like this:

```
print_r( PN\Xml2Array::getArrayElement('domain', 'pw', true ) );
```

##### Added in v1.3

[](#added-in-v13)

Want to get an attribute like:

```
...
```

See example1.php, use it like this:

```
print_r( Xml2Array::getArrayAttribute(null, 'result', 'code', true) );
```

Simple as that.

License
-------

[](#license)

MIT

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 94.4% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/a26b5e8ec4c0508518c6aa4df48c2b274b88a8cd653e11382ac3e0df1c6abcec?d=identicon)[PeterNotenboom](/maintainers/PeterNotenboom)

---

Top Contributors

[![PeterNotenboom](https://avatars.githubusercontent.com/u/8448364?v=4)](https://github.com/PeterNotenboom "PeterNotenboom (17 commits)")[![jovana](https://avatars.githubusercontent.com/u/645456?v=4)](https://github.com/jovana "jovana (1 commits)")

### Embed Badge

![Health badge](/badges/pn-epp-xml2array/health.svg)

```
[![Health](https://phpackages.com/badges/pn-epp-xml2array/health.svg)](https://phpackages.com/packages/pn-epp-xml2array)
```

###  Alternatives

[mtdowling/jmespath.php

Declaratively specify how to extract elements from a JSON document

2.0k472.8M135](/packages/mtdowling-jmespathphp)[opis/closure

A library that can be used to serialize closures (anonymous functions) and arbitrary data.

2.6k230.0M284](/packages/opis-closure)[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M229](/packages/masterminds-html5)[sabberworm/php-css-parser

Parser for CSS Files written in PHP

1.8k191.2M65](/packages/sabberworm-php-css-parser)[michelf/php-markdown

PHP Markdown

3.5k52.4M345](/packages/michelf-php-markdown)[jms/metadata

Class/method/property metadata management in PHP

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

PHPackages © 2026

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