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

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

devtoolboxuk/xml
================

XML Service

1.0.5(7y ago)03.3kMITPHPPHP &gt;=5.4.16

Since Sep 2Pushed 7y ago1 watchersCompare

[ Source](https://github.com/devtoolboxuk/xml)[ Packagist](https://packagist.org/packages/devtoolboxuk/xml)[ RSS](/packages/devtoolboxuk-xml/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (6)Dependencies (1)Versions (7)Used By (0)

XML
===

[](#xml)

Basic write XML Service from an Array, and a read XML service to an Array

TODO - Connect to Travis

Table of Contents
-----------------

[](#table-of-contents)

- [Background](#Background)
- [Usage](#Usage)
- [Maintainers](#Maintainers)
- [License](#License)

Background
----------

[](#background)

Used to create and read XML files

Usage
-----

[](#usage)

Usage of the XML service

```
$ composer require devtoolboxuk/xml
```

Then include Composer's generated vendor/autoload.php to enable autoloading:

```
require 'vendor/autoload.php';
```

```
use devtoolboxuk/xml;

$this->xmlService = new xmlService();
```

### Write XML Service

[](#write-xml-service)

##### Create the Writing XML service

[](#create-the-writing-xml-service)

```
$this->writeXMLService = $this->xmlService->writeXMLService();
```

##### Setting the Writing XML root name

[](#setting-the-writing-xml-root-name)

By default the root name is `root`

```
$this->writeXMLService->setRootName('products');
```

##### Example of Writing an XML

[](#example-of-writing-an-xml)

Plain XML

```
echo $this->writeXMLService->createDoc();
echo $this->writeXMLService->endDoc();
```

```

```

XML with attributes

```
echo $this->writeXMLService->createDoc();
echo $this->writeXMLService->endDoc([
    '@a' => [
        'xml_version' => '1.0',
    ]
]);
```

```

```

XML with data

```
echo $this->writeXMLService->createDoc();

echo $this->writeXMLService->create('product',[
    '@t'=>[
        'sku'=>12345,
        'text'=>'I am text',
    ]
]);

echo $this->writeXMLService->endDoc([
    '@a' => [
        'xml_version' => '1.0',
    ]
]);
```

```

    12345
    I am text

```

Maintainers
-----------

[](#maintainers)

[@DevToolboxUk](https://github.com/DevToolBoxUk).

License
-------

[](#license)

[MIT](LICENSE) © DevToolboxUK

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

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

Total

6

Last Release

2749d ago

PHP version history (2 changes)1.0.1PHP &gt;=5.3.3

1.0.3PHP &gt;=5.4.16

### Community

Maintainers

![](https://www.gravatar.com/avatar/11e7828108a460ad0b3dc92c08fa9e0e863168b8dae2b4d7041a6d699f936faa?d=identicon)[devtoolboxuk](/maintainers/devtoolboxuk)

---

Top Contributors

[![devtoolboxuk](https://avatars.githubusercontent.com/u/6337609?v=4)](https://github.com/devtoolboxuk "devtoolboxuk (8 commits)")

---

Tags

xml generatorXml ReaderXml Formatter

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

PHPackages © 2026

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