PHPackages                             crazedsanity/cs-phpxml - 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. crazedsanity/cs-phpxml

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

crazedsanity/cs-phpxml
======================

Library for reading, writing, and updating XML via PHP

v1.2.0(8y ago)0357MITPHPPHP &gt;=5.3.0

Since Jan 6Pushed 8y ago1 watchersCompare

[ Source](https://github.com/crazedsanity/cs-phpxml)[ Packagist](https://packagist.org/packages/crazedsanity/cs-phpxml)[ Docs](https://github.com/crazedsanity/cs-phpxml)[ RSS](/packages/crazedsanity-cs-phpxml/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (3)Versions (6)Used By (0)

BASICS:::
---------

[](#basics)

xmlParser{} is the class that parses an XML file or string.

xmlBuilder{} parses an array (like the one from xmlParser{}-&gt;get\_tree()) into an XML string.

xmlCreator{} is a set of methods to create an array like what xmlParser{} creates, and feeds it to xmlBuilder{} to create a useable XML string.

EXTERNAL LIBRARIES:
-------------------

[](#external-libraries)

1.) The "arrayToPath{}" object/class is available online at , or via Subversion at "".

2.) All projects which utilize these XML libraries have a "/lib" directory (beneath "public\_html", which holds index.php, etc.) that holds all the libraries: /lib/externals/ holds directories containing these libraries. An example layout:

```
/public_html/
	index.php
	subdir1/
	subdir2/
/lib/
	dir1/
	externals/
		cs-arrayToPath/
		cs-content/
		cs-phpxml/
	otherFolder/
/templates/
	somedir1/
	x/

```

3.)

### REMEMBER:

[](#remember)

1.) there can be ONLY ONE root element (the first index, "ROOT\_ELEMENT").

2.) the parser converts tags into UPPERCASE: lowercase indexes are special (attributes, type, value) a.) if an intermediate portion of the path is "value" (case insensitive), it is left as UPPERCASE b.) if the last part of the path is "value" (case insensitive), it is converted to lowercase only if that path exists.

3.) arrayToPath{} addresses arrays using paths, much like a unix filesystem. In the array below, the tag with a value of "AA Rechargeable Battery Pack" may be addressed as "/ROOT\_ELEMENT/SHOPPING-CART/ITEMS/ITEM/0/ITEM-NAME".

4.) when a tag is listed multiple times within the same parent tag, it is represented as a numerically-indexed array beneath the duplicated tag name: this parent tag will NOT have a "type" index. For an example, see /ROOT\_ELEMENT/SHOPPING-CART/ITEMS/ITEM in the array below.

5.) Attribute names are left in whatever case they were in, not converted to upper or lower like others!

### FORMAT OF ARRAYS:::

[](#format-of-arrays)

Array ( \[ROOT\_ELEMENT\] =&gt; Array ( \[type\] =&gt; open \[attributes\] =&gt; Array ( \[XMLNS\] =&gt; \[COMMENT\] =&gt; This is my comment )

```
         [SHOPPING-CART] => Array
             (
                 [type] => open
                 [ITEMS] => Array
                     (
                         [type] => open
                         [ITEM] => Array
                             (
                                 [0] => Array
                                     (
                                         [type] => open
                                         [ITEM-NAME] => Array
                                             (
                                                 [type] => complete
                                                 [value] => AA Rechargeable Battery Pack
                                             )

                                         [ITEM-DESCRIPTION] => Array
                                             (
                                                 [type] => complete
                                                 [value] => Battery pack containing four AA rechargeable batteries
                                             )

                                         [UNIT-PRICE] => Array
                                             (
                                                 [type] => complete
                                                 [attributes] => Array
                                                     (
                                                         [CURRENCY] => USD
                                                         [testValue] => this is just a Test.
                                                     )

                                                 [value] => 12.00
                                             )

                                         [QUANTITY] => Array
                                             (
                                                 [type] => complete
                                                 [value] => 1
                                             )

                                     )

                                 [1] => Array
                                     (
                                         [type] => open
                                         [ITEM-NAME] => Array
                                             (
                                                 [type] => complete
                                                 [value] => MegaSound 2GB MP3 Player
                                             )

                                         [ITEM-DESCRIPTION] => Array
                                             (
                                                 [type] => complete
                                                 [value] => Portable MP3 player - stores 500 songs
                                             )

                                         [UNIT-PRICE] => Array
                                             (
                                                 [type] => complete
                                                 [attributes] => Array
                                                     (
                                                         [CURRENCY] => USD
                                                     )

                                                 [value] => 178.00
                                             )

                                         [QUANTITY] => Array
                                             (
                                                 [type] => complete
                                                 [value] => 1
                                             )

                                     )

                             )

                     )

             )

     )

```

)

License
=======

[](#license)

Copyright (c) 2013 "crazedsanity" Dan Falconer Dual licensed under the MIT and GPL Licenses.

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

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

Total

4

Last Release

3224d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2e5c258da2d3360da7bc80c01e0a97ff96a036cef58f8a5434daf469ad7cc186?d=identicon)[crazedsanity](/maintainers/crazedsanity)

---

Top Contributors

[![crazedsanity](https://avatars.githubusercontent.com/u/1490894?v=4)](https://github.com/crazedsanity "crazedsanity (16 commits)")

---

Tags

phpxmldryoaoo

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/crazedsanity-cs-phpxml/health.svg)

```
[![Health](https://phpackages.com/badges/crazedsanity-cs-phpxml/health.svg)](https://phpackages.com/packages/crazedsanity-cs-phpxml)
```

###  Alternatives

[m1/vars

Vars is a simple to use and easily extendable configuration loader with in built loaders for ini, json, PHP, toml, XML and yaml/yml file types. It also comes with in built support for Silex and more frameworks to come soon.

64124.3k1](/packages/m1-vars)[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.

1338.9k](/packages/bupy7-xml-constructor)

PHPackages © 2026

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