PHPackages                             digitickets/lalit - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. digitickets/lalit

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

digitickets/lalit
=================

GitHub copy of LaLit's XML2Array and Array2XML

3.4.0(2y ago)721.3M↓26.1%416CC0-1.0PHPPHP &gt;=7CI passing

Since Apr 29Pushed 1mo ago6 watchersCompare

[ Source](https://github.com/digitickets/lalit)[ Packagist](https://packagist.org/packages/digitickets/lalit)[ Docs](http://www.lalit.org/lab)[ RSS](/packages/digitickets-lalit/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (18)Used By (6)

LaLit's XML2Array / Array2XML
=============================

[](#lalits-xml2array--array2xml)

[![GitHub Actions Workflow Status](https://camo.githubusercontent.com/5d9b3bbca03bea637a2b77929e83a81d477e00934a86266dbdd7cfec1a05f641/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f646967697469636b6574732f6c616c69742f2e676974687562253246776f726b666c6f7773253246706870756e69742e796d6c3f7374796c653d666f722d7468652d6261646765266c6f676f3d476974487562)](https://github.com/digitickets/lalit/actions)[![GitHub issues](https://camo.githubusercontent.com/daf52d00132bbfa59f04fefd2e3ac28718b2fb18114fec8d08ba08f56b33e9d0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f646967697469636b6574732f6c616c69742e7376673f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562)](https://github.com/digitickets/lalit/issues)

[![PHP Version](https://camo.githubusercontent.com/ff688949753d8da439024d128e3719c0c0ad5f69a0e869088af0bb08e3bf33b7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f646967697469636b6574732f6c616c69742e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/digitickets/lalit)[![Stable Version](https://camo.githubusercontent.com/86235b4455c92290ef48a8b8ce1b9abfe44e0c212ae77a746d315f622c1fd521/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f646967697469636b6574732f6c616c69742e7376673f7374796c653d666f722d7468652d6261646765266c6162656c3d4c6174657374)](https://packagist.org/packages/digitickets/lalit)

[![Total Downloads](https://camo.githubusercontent.com/c89506727df9fb371510dc640fed1dd6725497bc1a251c70ce216ccdafd2337b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f646967697469636b6574732f6c616c69742e7376673f7374796c653d666f722d7468652d6261646765266c6162656c3d546f74616c2b646f776e6c6f616473)](https://packagist.org/packages/digitickets/lalit)[![Monthly Downloads](https://camo.githubusercontent.com/78cb3fb46c0376fe2ab68493c2d69e65ac14fa5a98e3d67a8c7da705b40e558b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f646967697469636b6574732f6c616c69742e7376673f7374796c653d666f722d7468652d6261646765266c6162656c3d4d6f6e74686c792b646f776e6c6f616473)](https://packagist.org/packages/digitickets/lalit)[![Daily Downloads](https://camo.githubusercontent.com/b01863d2ef3aa45b3c11f579450b99e8f3613dd3e81da437fab6d42496272b2a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64642f646967697469636b6574732f6c616c69742e7376673f7374796c653d666f722d7468652d6261646765266c6162656c3d4461696c792b646f776e6c6f616473)](https://packagist.org/packages/digitickets/lalit)

`LaLit` allows you to convert XML to a PHP array and back again.

The base code was developed by Lalit Patel and *was* available from

From around May 7th 2018, the original site is not available.

The Internet Archive copies are mentioned below.

The original code was in the initial commit and all subsequent work has been carried out by me (Richard Quadling) and the contributors. Hopefully I've mentioned them all in the [CHANGELOG.md](CHANGELOG.md).

XML2Array : [Original page](http://www.lalit.org/lab/convert-xml-to-array-in-php-xml2array/) / [Internet Archive](https://web.archive.org/web/20180430042542/www.lalit.org/lab/convert-xml-to-array-in-php-xml2array).

Array2XML : [Original page](http://www.lalit.org/lab/convert-php-array-to-xml-with-attributes/) / [Internet Archive](https://web.archive.org/web/20180507121143/www.lalit.org/lab/convert-php-array-to-xml-with-attributes).

I've added additional unit tests via a generator (so probably too many tests)

Extended usage
==============

[](#extended-usage)

Alternative labelling
---------------------

[](#alternative-labelling)

As of v3.2.0, the `init()` method has been expanded to allow the labels used in the output `XML2Array::createArray()` and the input to `Array2XML::createXML()` to be changed. Any value, where `null` is supplied will revert to the default value.

Version History
===============

[](#version-history)

Please read the [CHANGELOG](CHANGELOG.md) document.

@todo
=====

[](#todo)

1. Add support for `` within the XML, such that when converting from XML -&gt; PHP -&gt; XML, the comments are preserved.

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance60

Regular maintenance activity

Popularity56

Moderate usage in the ecosystem

Community27

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 94.2% 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 ~202 days

Recently: every ~567 days

Total

17

Last Release

801d ago

Major Versions

1.6.3 → 2.0.02016-11-17

2.0.0 → 3.0.02017-02-09

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/23523887?v=4)[DigiTickets](/maintainers/DigiTickets)[@digitickets](https://github.com/digitickets)

---

Top Contributors

[![rquadling](https://avatars.githubusercontent.com/u/12801?v=4)](https://github.com/rquadling "rquadling (49 commits)")[![JanisE](https://avatars.githubusercontent.com/u/1469104?v=4)](https://github.com/JanisE "JanisE (1 commits)")[![mwinandy](https://avatars.githubusercontent.com/u/1233357?v=4)](https://github.com/mwinandy "mwinandy (1 commits)")[![stickler-ci](https://avatars.githubusercontent.com/u/16011037?v=4)](https://github.com/stickler-ci "stickler-ci (1 commits)")

---

Tags

xmlarray

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/digitickets-lalit/health.svg)

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

###  Alternatives

[openlss/lib-array2xml

Array2XML conversion library credit to lalit.org

31052.5M47](/packages/openlss-lib-array2xml)[hiraku/xml_builder

Simple DSL for building XML

141.6k1](/packages/hiraku-xml-builder)

PHPackages © 2026

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