PHPackages                             traineratwot/xmltodict - 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. traineratwot/xmltodict

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

traineratwot/xmltodict
======================

xml parser LIKE python xmltodict

2.0(2mo ago)185GPL-3.0-or-laterPHPPHP &gt;=8.2

Since May 20Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/Traineratwot/XmlToDict)[ Packagist](https://packagist.org/packages/traineratwot/xmltodict)[ RSS](/packages/traineratwot-xmltodict/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (1)Versions (5)Used By (0)

XmlToDict
=========

[](#xmltodict)

A complete analogue of XmlToDict for python, but written in PHP

Полный аналог XmlToDict для python, но написанный на PHP

install
=======

[](#install)

```
composer require traineratwot/xmltodict
```

Usage
-----

[](#usage)

```
$array = XmlToDict::load(__DIR__ . '/test.xml');

$xml = file_get_contents(__DIR__ . '/test.xml')
$array = XmlToDict::parse($xml);
```

example
-------

[](#example)

```

		Harry Potter and the Philosopher's Stone
		J.K. Rowling
		Bloomsbury
		1997

		The Lord of the Rings
		J.R.R. Tolkien
		George Allen &amp; Unwin
		1954

	Text
	Text

```

```
{
    "books": {
        "book": [
            {
                "@id": "1",
                "title": {
                    "@meta": "test",
                    "#text": "Harry Potter and the Philosopher's Stone"
                },
                "author": "J.K. Rowling",
                "publisher": "Bloomsbury",
                "year": "1997"
            },
            {
                "@id": "2",
                "title": {
                    "@meta": "test2",
                    "#text": "The Lord of the Rings"
                },
                "author": "J.R.R. Tolkien",
                "publisher": "George Allen & Unwin",
                "year": "1954"
            }
        ],
        "item": "Text",
        "item2": {
            "@desc": "Lorem",
            "#text": "Text"
        },
        "item3": null
    }
}
```

supported
---------

[](#supported)

php 7.3+

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance84

Actively maintained with recent releases

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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

Every ~333 days

Total

4

Last Release

88d ago

Major Versions

1.1.1 → 2.02026-02-14

PHP version history (2 changes)1.0.0PHP &gt;=7.2

2.0PHP &gt;=8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/258daf0924571b74f805d1928446978bc93dd75265197ae9ac7dac47c70ddd83?d=identicon)[Traineratwot](/maintainers/Traineratwot)

---

Top Contributors

[![Traineratwot](https://avatars.githubusercontent.com/u/41589091?v=4)](https://github.com/Traineratwot "Traineratwot (18 commits)")

---

Tags

xmlparserxml-to-arrayxml2arrayxmltoarrayXMLtoJSONxml2jsonxmltodictxml to json

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/traineratwot-xmltodict/health.svg)

```
[![Health](https://phpackages.com/badges/traineratwot-xmltodict/health.svg)](https://phpackages.com/packages/traineratwot-xmltodict)
```

###  Alternatives

[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M229](/packages/masterminds-html5)[imangazaliev/didom

Simple and fast HTML parser

2.2k2.3M64](/packages/imangazaliev-didom)[orchestra/parser

XML Document Parser for Laravel and PHP

4581.7M5](/packages/orchestra-parser)[veewee/xml

XML without worries

1835.9M29](/packages/veewee-xml)[laravie/parser

XML Document Parser for PHP

2342.1M8](/packages/laravie-parser)[goetas-webservices/xsd-reader

Read any XML Schema (XSD) programmatically with PHP

624.7M15](/packages/goetas-webservices-xsd-reader)

PHPackages © 2026

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