PHPackages                             pastuhov/php-xml2object - 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. pastuhov/php-xml2object

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

pastuhov/php-xml2object
=======================

Parse xml to object.

v1.0.0(8y ago)021MITPHPPHP &gt;=7.0.0

Since Aug 7Pushed 8y ago1 watchersCompare

[ Source](https://github.com/pastuhov/php-xml2object)[ Packagist](https://packagist.org/packages/pastuhov/php-xml2object)[ Docs](https://github.com/pastuhov/php-xml2object)[ RSS](/packages/pastuhov-php-xml2object/feed)WikiDiscussions master Synced 5d ago

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

[![Build Status](https://camo.githubusercontent.com/0d581b9364e1cbb18d97297acc2a51f3262801af127b74ef9cfd3c5df1c41e6c/68747470733a2f2f7472617669732d63692e6f72672f7061737475686f762f7068702d786d6c326f626a6563742e737667)](https://travis-ci.org/pastuhov/php-xml2object)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/f72ff96b5b7f4036f689acbfecf7d2b217b60819688bbf3bf34bf7f45528479b/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7061737475686f762f7068702d786d6c326f626a6563742f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/pastuhov/php-xml2object/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/b8110244715635693492c39c3481ea5f92083508bec652da09a08430c97fad85/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7061737475686f762f7068702d786d6c326f626a6563742f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/pastuhov/php-xml2object/?branch=master)[![Total Downloads](https://camo.githubusercontent.com/6c25d6d58a870e6966634491e38f8663531d0d342da72580fff766a184361fd6/68747470733a2f2f706f7365722e707567782e6f72672f7061737475686f762f7068702d786d6c326f626a6563742f646f776e6c6f616473)](https://packagist.org/packages/pastuhov/php-xml2object)

Converts XML to object
======================

[](#converts-xml-to-object)

Input:

```

```

Output:

```
{
    "_tagName": "root",
    "_childrenProperty": "children",
    "children": [
        {
            "_tagName": "detail",
            "_childrenProperty": "properties",
            "detailid": "3721899",
            "formattedoem": "90311-71001",
            "manufacturer": "TOYOTA",
            "properties": [
                {
                    "_tagName": "property",
                    "_childrenProperty": null,
                    "code": "Name",
                    "detailpropertyid": "6086730",
                    "locale": "en_US",
                    "property": "Наименование"
                },
                {
                    "_tagName": "property",
                    "_childrenProperty": null,
                    "property": "Наименование",
                    "rate": "5",
                    "value": "ｶﾑｼｬﾌﾄｾｯﾃｨﾝｸﾞ ｵｲﾙ ｼｰﾙ"
                },
                {
                    "_tagName": "property",
                    "_childrenProperty": null,
                    "rate": "5",
                    "value": "0.035 кг"
                }
            ]
        },
        {
            "_tagName": "detail",
            "_childrenProperty": "properties",
            "detailid": "4445210",
            "formattedoem": "20621-71001",
            "manufacturer": "TOYOTA",
            "properties": [
                {
                    "_tagName": "property",
                    "_childrenProperty": null,
                    "code": "Name",
                    "detailpropertyid": "6086730",
                    "locale": "en_US",
                    "property": "Наименование"
                },
                {
                    "_tagName": "property",
                    "_childrenProperty": null,
                    "property": "Наименование",
                    "rate": "5",
                    "value": "ｶﾑｼｬﾌﾄｾｯﾃｨﾝｸﾞ ｵｲﾙ ｼｰﾙ"
                }
            ]
        }
    ]
}
```

Features
--------

[](#features)

- converts desired tags to properties
- fast
- memory saving

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist pastuhov/php-xml2object

```

or add

```
"require-dev": {
    "pastuhov/php-xml2object": "~1.0.0"
    ...

```

to the require section of your `composer.json` file.

Usage
-----

[](#usage)

```
use pastuhov\xml2object\Parser;

$converter = new Parser();
$converter->xml = file_get_contents(__DIR__ . '/data/xml.xml');
$object = $converter->process();
```

Testing
-------

[](#testing)

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

Security
--------

[](#security)

If you discover any security related issues, please email [pastukhov\_k@sima-land.ru](mailto:pastukhov_k@sima-land.ru) instead of using the issue tracker.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

3204d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7937221?v=4)[Pastuhov Kirill](/maintainers/pastuhov)[@pastuhov](https://github.com/pastuhov)

---

Top Contributors

[![pastuhov](https://avatars.githubusercontent.com/u/7937221?v=4)](https://github.com/pastuhov "pastuhov (5 commits)")

---

Tags

converterjsonobjectparserphpxml

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/pastuhov-php-xml2object/health.svg)

```
[![Health](https://phpackages.com/badges/pastuhov-php-xml2object/health.svg)](https://phpackages.com/packages/pastuhov-php-xml2object)
```

###  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)
