PHPackages                             deepeloper/lib-xml - 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. deepeloper/lib-xml

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

deepeloper/lib-xml
==================

XML library allowing to parse XML as array converting node values/attributes types using XSD

3.1.0(4mo ago)2391MITPHPPHP &gt;=8.1CI passing

Since Jul 29Pushed 4mo ago2 watchersCompare

[ Source](https://github.com/deepeloper/lib-xml)[ Packagist](https://packagist.org/packages/deepeloper/lib-xml)[ Docs](https://github.com/deepeloper/lib-xml)[ RSS](/packages/deepeloper-lib-xml/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (3)Versions (9)Used By (1)

XML library allowing to parse XML as array converting node values/attributes types using XSD.
=============================================================================================

[](#xml-library-allowing-to-parse-xml-as-array-converting-node-valuesattributes-types-using-xsd)

[![Packagist version](https://camo.githubusercontent.com/6cfed147f0e26b138746fe0f25b355c66dd7fe3961182e5dbb1bd2a32f203f80/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f64656570656c6f7065722f6c69622d786d6c)](https://packagist.org/packages/deepeloper/lib-xml)[![PHP from Packagist](https://camo.githubusercontent.com/d11dbf8204f591a89caa5c31cc859e2e2053000f6dfc0af632adf05499576a45/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f64656570656c6f7065722f6c69622d786d6c2e737667)](http://php.net/)[![GitHub license](https://camo.githubusercontent.com/d1bb677c4ec983bca7c23851ae33f93eb83947e0f7c382b03b2101c3785acd79/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f64656570656c6f7065722f6c69622d786d6c2e737667)](https://github.com/deepeloper/lib-xml/blob/main/LICENSE)[![GitHub issues](https://camo.githubusercontent.com/38c58eb3b5f57f82d589a3cd7641577a3979da55ec4c8ecdbfc41bc501795244/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732d7261772f64656570656c6f7065722f6c69622d786d6c2e737667)](https://github.com/deepeloper/lib-xml/issues)[![Packagist](https://camo.githubusercontent.com/d514714610dadf45b7a6e551b279d630abd921084711ca105558c123df6bd65a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f64656570656c6f7065722f6c69622d786d6c2e737667)](https://packagist.org/packages/deepeloper/lib-xml)[![CI](https://github.com/deepeloper/lib-xml/actions/workflows/ci.yml/badge.svg?event=push)](https://github.com/deepeloper/lib-xml/actions)[![codecov](https://camo.githubusercontent.com/3252fb533e9b67f2fb0aa43e28b89f5532f415b02a5ac4eb9b71a44a5d6dd056/68747470733a2f2f636f6465636f762e696f2f67682f64656570656c6f7065722f6c69622d786d6c2f6272616e63682f6d61696e2f67726170682f62616467652e737667)](https://codecov.io/gh/deepeloper/lib-xml)

[![Donation](https://camo.githubusercontent.com/a59a69ad3d5f2b3205fc267af930d371787bc02ca5a4369f1d2556b119b28f16/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f446f6e6174696f6e2d566973612c2532304d6173746572436172642c2532304d61657374726f2c253230556e696f6e5061792c253230596f6f4d6f6e65792c2532302544302539432544302539382544302541302d726564)](https://yoomoney.ru/to/41001351141494)

Compatibility
-------------

[](#compatibility)

![PHP 5.4](https://camo.githubusercontent.com/3e9ba9eda4add7ba7d9edce95767cf814bc979e6005804331a80941c54023353/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d2533453d352e342d253233374138364238)

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

[](#installation)

`composer require deepeloper/lib-xml`

Usage
-----

[](#usage)

```
use deepeloper\Lib\XML\Converter;

require_once "/path/to/vendor/autoload.php";

$converter = new Converter();

// @see https://www.php.net/manual/en/function.xml-parse-into-struct.php#66487
// Little bit modified.
$xml = $converter->xmlToArray(
    file_get_contents("/path/to/xml")
);

// lib-xml true,
        // Optional, used to move children from '/children' key to the element as arrays named as child name.
        Converter::COLLAPSE_CHILDREN => true,
        // Optional, used to convert arrays from previous option as 'name' => "value".
        Converter::COLLAPSE_ARRAYS => [
            // Optional, used to exclude collapsing for list of the elements.
            'exclusions' => [
                "node/subnode/...",
                // ...,
            ],
        ],
    ]
);

// lib-xml>=3.0.0, PHP>=8.1:
$xml = $converter->parse(
    file_get_contents("/path/to/xml"),
    [
        file_get_contents("/path/to/xsd1"),
        file_get_contents("/path/to/xsd2"),
        // ...
    ],
    [
        Converter::COLLAPSE_ATTRIBUTES => true,
        Converter::COLLAPSE_CHILDREN => true,
        Converter::COLLAPSE_ARRAYS => [
            'exclusions' => [
                "node/subnode/...",
                // ...,
            ],
        ],
    ]
);
```

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance74

Regular maintenance activity

Popularity10

Limited adoption so far

Community10

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

Every ~147 days

Recently: every ~221 days

Total

7

Last Release

140d ago

Major Versions

1.1.0 → 2.0.02023-07-29

2.1.0 → 3.0.02023-08-04

PHP version history (5 changes)1.0.0PHP &gt;=5.4

1.1.0PHP &gt;=5.6

2.0.0PHP &gt;=7.1

2.1.0PHP &gt;=7.3

3.0.0PHP &gt;=8.1

### Community

Maintainers

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

---

Top Contributors

[![deepeloper](https://avatars.githubusercontent.com/u/1831371?v=4)](https://github.com/deepeloper "deepeloper (37 commits)")

---

Tags

phpxmllibraryxsd

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/deepeloper-lib-xml/health.svg)

```
[![Health](https://phpackages.com/badges/deepeloper-lib-xml/health.svg)](https://phpackages.com/packages/deepeloper-lib-xml)
```

###  Alternatives

[goetas-webservices/xsd2php

Convert XSD (XML Schema) definitions into PHP classes and JMS metadata

2411.6M37](/packages/goetas-webservices-xsd2php)[goetas-webservices/xsd2php-runtime

Convert XSD (XML Schema) definitions into PHP classes

4910.9M36](/packages/goetas-webservices-xsd2php-runtime)[goetas-webservices/xsd-reader

Read any XML Schema (XSD) programmatically with PHP

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

Convert XSD (XML Schema) definitions into PHP classes

493.3k](/packages/goetas-xsd2php-runtime)[bupy7/xml-constructor

The array-like constructor of XML document structure.

1337.9k](/packages/bupy7-xml-constructor)[leonelquinteros/php-toml

PHP parser for TOML language ( https://github.com/toml-lang/toml )

266.7k](/packages/leonelquinteros-php-toml)

PHPackages © 2026

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