PHPackages                             greencape/xml-converter - 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. greencape/xml-converter

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

greencape/xml-converter
=======================

A PHP XML parser and compiler that provides an easy way to convert XML into native PHP arrays and back again. No dependencies on external libraries or extensions.

2.1.0(4y ago)954.8k↓39.6%2[1 PRs](https://github.com/GreenCape/xml-converter/pulls)2MITPHPPHP &gt;=7.2CI failing

Since Aug 3Pushed 3y ago1 watchersCompare

[ Source](https://github.com/GreenCape/xml-converter)[ Packagist](https://packagist.org/packages/greencape/xml-converter)[ Docs](https://github.com/GreenCape/xml-converter)[ RSS](/packages/greencape-xml-converter/feed)WikiDiscussions master Synced 1mo ago

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

PHP XML Converter
=================

[](#php-xml-converter)

[![SensioLabsInsight](https://camo.githubusercontent.com/6b9e7fc5b763428caf98d91b77879f7556d621148e4cb4c0bd8ee55ac8da1742/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f39623930643337392d646466302d343435612d386134392d3735323433343264653837662f6d696e692e706e67)](https://camo.githubusercontent.com/6b9e7fc5b763428caf98d91b77879f7556d621148e4cb4c0bd8ee55ac8da1742/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f39623930643337392d646466302d343435612d386134392d3735323433343264653837662f6d696e692e706e67)[![Code Climate](https://camo.githubusercontent.com/fe5728b1ca24e0fb2ba4260241eb5da455a673ea267dc3ec77df1662ebfbde59/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f477265656e436170652f786d6c2d636f6e7665727465722f6261646765732f6770612e737667)](https://codeclimate.com/github/GreenCape/xml-converter)[![Test Coverage](https://camo.githubusercontent.com/a73236dfdf768a554d504b730bfd38e6f0d8559d7a1bad30a09285351a8051fd/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f477265656e436170652f786d6c2d636f6e7665727465722f6261646765732f636f7665726167652e737667)](https://codeclimate.com/github/GreenCape/xml-converter/coverage)[![Latest Stable Version](https://camo.githubusercontent.com/9f1ed9273b411473621f873f2b253dd2d630f32ff075c505115da3dfd4aa00af/68747470733a2f2f706f7365722e707567782e6f72672f677265656e636170652f786d6c2d636f6e7665727465722f762f737461626c652e706e67)](https://packagist.org/packages/greencape/xml-converter)[![Build Status](https://camo.githubusercontent.com/3ffd58a5a1ff653480e091cefa8d24a7739b1d745a98bd0f631875ac9e8b8ba9/68747470733a2f2f6170692e7472617669732d63692e6f72672f477265656e436170652f786d6c2d636f6e7665727465722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/greencape/xml-converter)

A PHP XML parser class that provides an easy way to convert XML into native PHP arrays and back again. It has no dependencies on any external libraries or extensions bundled with PHP. The entire parser is concisely written in PHP.

This project is actively maintained. It is used in our production code. If you spot an issue, please let us know through the Issues section on our Github project page:

In short, this project makes sense for those who want to simplify their PHP install and use, have a need for a simple XML parser, but don't much care about speed.

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

[](#requirements)

PHP 7.2+

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

[](#installation)

### Composer

[](#composer)

Simply add a dependency on `greencape/xml-converter` to your project's `composer.json` file if you use [Composer](http://getcomposer.org/) to manage the dependencies of your project. Here is a minimal example of a `composer.json` file that just defines a dependency on XML Converter:

```
{
    "require": {
        "greencape/xml-converter": "*@dev"
    }
}
```

For a system-wide installation via Composer, you can run:

```
$ composer global require 'greencape/xml-converter=*'
```

Make sure you have `~/.composer/vendor/bin/` in your path.

Usage Examples
--------------

[](#usage-examples)

### XML String to PHP Array

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

```
