PHPackages                             rummykhan/easy-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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. rummykhan/easy-xml

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

rummykhan/easy-xml
==================

Convert your data to xml string easily.

1.0.6(8y ago)06.3k[1 issues](https://github.com/rummykhan/easy-xml/issues)MITPHPPHP &gt;=7.0

Since Nov 21Pushed 8y ago1 watchersCompare

[ Source](https://github.com/rummykhan/easy-xml)[ Packagist](https://packagist.org/packages/rummykhan/easy-xml)[ RSS](/packages/rummykhan-easy-xml/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (9)Used By (0)

EasyXML
=======

[](#easyxml)

This package helps you in converting your data to XML easily. This package is independent of any php framework. But I took care of two popular frameworks specifically

1. [For use in Laravel](https://github.com/rummykhan/easy-xml/blob/master/Laravel.md)
2. [For use in YII 2.0](https://github.com/rummykhan/easy-xml/blob/master/YII-2.0.md)

To use in any framework
-----------------------

[](#to-use-in-any-framework)

### Installation

[](#installation)

Install using composer

```
composer require rummykhan/easy-xml
```

Wit the constructor initialization you can use it any framework you may like.

```
$rootNode = new XmlNode('person');

$educationNode = new XmlNode('education');
$educationNode->addAttributes(['MOE' => 'SXC', 'DAE' => 'COE', 'BA' => 'UOS']);
$rootNode->addChildNode($educationNode);

$jobNode = new XmlNode('job');

$jobNode->addAttribute('first', 'https://best-bf.com');
$jobNode->addAttribute('second', 'https://infamous.ae');
$jobNode->addAttribute('third', 'https://awok.com');
$jobNode->addAttribute('fourth', 'https://helpbit.com');

$rootNode->addChildNode($jobNode)
    ->setDeclaration(XmlDeclaration::V1);

// since it implements php __toString() method
dd((string)$rootNode);
// OR
dd($rootNode->toString());
```

will output

```

```

`RummyKhan\EasyXml\XmlNode` API
-------------------------------

[](#rummykhaneasyxmlxmlnode-api)

### `addChildNode`

[](#addchildnode)

To add a child node to XmlNode. e.g.

```
$rootNode = new XmlNode('employees');
$employeeNode = new XmlNode('employee');

$rootNode->addChildNode($employeeNode);
```

### `setValue`

[](#setvalue)

To set the value of the node. Node can either have other node as children or it has a primitive value.

```
$rootNode = new XmlNode('name');
$rootNode->setValue('rummykhan');
```

### `addAttribute`

[](#addattribute)

To add the attribute for the xml node.

```
$rootNode = new XmlNode('person');
$rootNode->addAttribute('age', 30);
```

### `addAttributes`

[](#addattributes)

To add multiple attributes for the xml node. e.g.

```
$rootNode = new XmlNode('person');
$rootNode->addAttributes([
    'name' => 'rummykhan',
    'age' => 30
]);
```

### `setDeclaration`

[](#setdeclaration)

To set the [Xml declaration](http://xmlwriter.net/xml_guide/xml_declaration.shtml)

```
$rootNode = new XmlNode('employees');
$rootNode->setDeclaration('');
```

### `toString`

[](#tostring)

To convert xml single node or xml node hierarchy to xml string.

```
$rootNode = new XmlNode('employees');
dd($rootNode->toString());
```

### Contact

[](#contact)

[rehan\_manzoor@outlook.com](mailto://rehan_manzoor@outlook.com)

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

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

Total

7

Last Release

3144d ago

PHP version history (2 changes)1.0.0PHP &gt;=5.5.9

1.0.2PHP &gt;=7.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/12664104?v=4)[Rehan Manzoor](/maintainers/rummykhan)[@rummykhan](https://github.com/rummykhan)

---

Top Contributors

[![rummykhan](https://avatars.githubusercontent.com/u/12664104?v=4)](https://github.com/rummykhan "rummykhan (13 commits)")

---

Tags

conver-data-to-xmllaravelxmlyii2xmllaravel 5yii-2.0Convert data to XML

### Embed Badge

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

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

###  Alternatives

[masterminds/html5

An HTML5 parser and serializer.

1.8k269.7M301](/packages/masterminds-html5)[jms/serializer

Library for (de-)serializing data of any complexity; supports XML, and JSON.

2.3k141.9M908](/packages/jms-serializer)[jms/metadata

Class/method/property metadata management in PHP

1.8k160.2M96](/packages/jms-metadata)[jms/serializer-bundle

Allows you to easily serialize, and deserialize data of any complexity

1.8k91.4M667](/packages/jms-serializer-bundle)[hassankhan/config

Lightweight configuration file loader that supports PHP, INI, XML, JSON, and YAML files

1.0k13.8M184](/packages/hassankhan-config)[sabre/xml

sabre/xml is an XML library that you may not hate.

55234.6M139](/packages/sabre-xml)

PHPackages © 2026

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