PHPackages                             lianhua/superxml - 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. lianhua/superxml

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

lianhua/superxml
================

A simple library for XML manipulation

1.0.1(5y ago)024GPL-3.0PHPPHP &gt;=7.3

Since May 7Pushed 5y ago1 watchersCompare

[ Source](https://github.com/Nevermille/PHP-SuperXML)[ Packagist](https://packagist.org/packages/lianhua/superxml)[ RSS](/packages/lianhua-superxml/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependencies (2)Versions (4)Used By (0)

PHP SuperXML
============

[](#php-superxml)

A little library for XML manipulation in PHP

[![Build Status](https://camo.githubusercontent.com/e422746abc1ebefd30626507a8408ae2e75073ea9ca6a588fc9925095639ca19/68747470733a2f2f7472617669732d63692e636f6d2f4e657665726d696c6c652f5048502d5375706572584d4c2e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/Nevermille/PHP-SuperXML) [![BCH compliance](https://camo.githubusercontent.com/2cfb8e10d5b8ad0168c7661e26af8c17962c7ac24f875afd84f431a1c692200e/68747470733a2f2f626574746572636f64656875622e636f6d2f656467652f62616467652f4e657665726d696c6c652f5048502d5375706572584d4c3f6272616e63683d6d6173746572)](https://bettercodehub.com/) [![License: GPL v3](https://camo.githubusercontent.com/48bf9b56d44f38db53ce21294cf0b9487d0a3734ab3ba1fe4c69858ae20db2c1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d47504c76332d626c75652e737667)](https://www.gnu.org/licenses/gpl-3.0)

Overview
--------

[](#overview)

A simple library to manipulate XML files in PHP

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

[](#compatibility)

This library has been tested for PHP 7.3 and higher

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

[](#installation)

Just use composer in your project:

```
composer require lianhua/superxml

```

If you don't use composer, clone or download this repository, all you need is inside the src directory.

Usage
-----

[](#usage)

### Open a XML file

[](#open-a-xml-file)

Let's say we have the following XML file:

```

        Apple
        Banana

        Carrot

```

You can open this document with a new SuperXML:

```
$xml = new SuperXML("/path/to/xml/file");
```

### Search nodes

[](#search-nodes)

You can search all nodes from a XPath expression:

```
$nodes = $xml->xpathQuery("/inventory/fruits/fruit"); // DOMNodeList with 'Apple' and 'Banana' nodes
```

### Evaluate expression

[](#evaluate-expression)

You can evaluate an XPath expression:

```
$count = $xml->xpathEval("count(/inventory/fruits/fruit)"); // 2
```

### Create a node

[](#create-a-node)

You can create a node with the XPath expression of the parent:

```
$xml->addChild("/inventory/fruits", "fruit", "Kiwi");
```

The document becomes:

```

        Apple
        Banana
        Kiwi

        Carrot

```

### Delete a node

[](#delete-a-node)

You can delete a node:

```
$xml->remove("/inventory/vegetables/vegetable");
```

The document becomes:

```

        Apple
        Banana

```

### Replace a value

[](#replace-a-value)

You can replace a node value:

```
$xml->replaceValue("/inventory/vegetables/vegetable", "Potato");
```

The document becomes:

```

        Apple
        Banana

        Potato

```

### Set an attribute

[](#set-an-attribute)

You can set an attribute to nodes:

```
$xml->setAttribute("/document/vegetables/vegetable[.='Carrot']", "growIn", "soil");
```

The document becomes:

```

        Apple
        Banana

        Carrot

```

### Remove an attribute

[](#remove-an-attribute)

You can remove an attribute, let's say you have the last example to start with:

```
$xml->removeAttribute("/document/vegetables/vegetable[.='Carrot']", "growIn", "soil");
```

The document becomes:

```

        Apple
        Banana

        Carrot

```

### Autosaving

[](#autosaving)

By default, the document is saved each time you edit it. To avoid this, set the second constructor parameter to false :

```
$xml = new SuperXML("/path/to/xml/file", false);
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

Total

2

Last Release

2163d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/38858480?v=4)[Camille Nevermind](/maintainers/Nevermille)[@nevermille](https://github.com/nevermille)

---

Top Contributors

[![nevermille](https://avatars.githubusercontent.com/u/38858480?v=4)](https://github.com/nevermille "nevermille (1 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/lianhua-superxml/health.svg)

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

###  Alternatives

[alexsabur/orchid-editorjs-field

A orchid editorjs field

1327.4k](/packages/alexsabur-orchid-editorjs-field)

PHPackages © 2026

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