PHPackages                             zedisdog/array-into-xml-in-two-way - 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. zedisdog/array-into-xml-in-two-way

ActiveLib

zedisdog/array-into-xml-in-two-way
==================================

array into xml in two way

v0.5.2(10y ago)168Apache License 2.0PHPPHP &gt;=5.4

Since Dec 14Pushed 8y ago1 watchersCompare

[ Source](https://github.com/zedisdog/array-into-xml-in-two-way)[ Packagist](https://packagist.org/packages/zedisdog/array-into-xml-in-two-way)[ RSS](/packages/zedisdog-array-into-xml-in-two-way/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (7)Used By (0)

\#array into XML in two-way

\##说明 这是从[lalit.lab](http://www.lalit.org/)上面拿到的array2xml和xml2array类。后来发现array2xml并没有满足我的要求。我就自己改了一下。现在array2xml通过实例化对象来使用。使用addNode方法可以随时添加节点。目前可能还不太灵活，有时间了继续优化它吧。 ##原地址

- [array2xml](http://www.lalit.org/lab/convert-php-array-to-xml-with-attributes/)
- [xml2array](http://www.lalit.org/lab/convert-xml-to-array-in-php-xml2array/)

使用前的准备
------

[](#使用前的准备)

在 composer.json 文件中申明依赖：

```
"zedisdog/array-into-xml-in-two-way": "~0.5.0"
```

\##上手

\###array2xml 注意：用法跟原来的不一样了。 实例化对象之后，将自动生成一个id属性为root的根节点。之后有空了，我会是它可以容易的添加id属性，以此来方便插入节点到指定的节点中。

```
$xml = new Array2XML('root_node_name', $version /*='1.0'*/, $encoding /*='utf-8'*/);
$xml->addNode($node_name,$arr,$parentId/*='root'*/);
echo $xml->saveXML();
```

\###xml2array The usage is pretty simple. You have to include the class file in your code and call the following function.

```
$array = XML2Array::createArray($xml);
print_r($array);
```

Important thing to note is that the $array returned can be converted back to XML using the Array2XML class.

致谢
--

[](#致谢)

- [lalit.lab](http://www.lalit.org/)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

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 ~0 days

Total

6

Last Release

3799d ago

### Community

Maintainers

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

---

Top Contributors

[![zedisdog](https://avatars.githubusercontent.com/u/8280666?v=4)](https://github.com/zedisdog "zedisdog (26 commits)")

### Embed Badge

![Health badge](/badges/zedisdog-array-into-xml-in-two-way/health.svg)

```
[![Health](https://phpackages.com/badges/zedisdog-array-into-xml-in-two-way/health.svg)](https://phpackages.com/packages/zedisdog-array-into-xml-in-two-way)
```

PHPackages © 2026

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