PHPackages                             kfosoft/php-xml-helper - 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. kfosoft/php-xml-helper

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

kfosoft/php-xml-helper
======================

PHP XML Helper

1.0.1(10y ago)03931PHPPHP &gt;=5.4.0

Since Sep 9Pushed 10y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (3)Used By (1)

PHP XML Helper
==============

[](#php-xml-helper)

##### Class for encode xml string to array or object &amp; encode array to SimpleXMLElement

[](#class-for-encode-xml-string-to-array-or-object--encode-array-to-simplexmlelement)

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

[](#installation)

Installation with Composer

Either run

```
    php composer.phar require --prefer-dist kfosoft/php-xml-helper:"*"

```

or add in composer.json

```
    "require": {
        ...
        "kfosoft/php-xml-helper":"*"
    }

```

Well done!

Example encode
--------------

[](#example-encode)

```
$xml = (new XML())->encode(array(
        'book' => array(
            1,
            'page' => 1,
        ),
        'book1' => array(
            'attribute:test' => 2,
            'attribute:test2' => 'testValue',
            'page' => 1,
            'page1' => 'testValue',
        ),
), 'document')

```

##### Result:

[](#result)

```

111testValue

```

Example decode
--------------

[](#example-decode)

```
$xml = '
111testValue';

$xml = (new XML())->decode($xml);

or

$xml = (new XML())->decode($xml,true);

```

##### Result:

[](#result-1)

```
To array:
array(2) {
  'book' =>
  array(2) {
    [0] =>
    string(1) "1"
    'page' =>
    string(1) "1"
  }
  'book1' =>
  array(3) {
    'attribute:' =>
    array(2) {
      'test' =>
      string(1) "2"
      'test2' =>
      string(9) "testValue"
    }
    'page' =>
    string(1) "1"
    'page1' =>
    string(9) "testValue"
  }
}

To object:
class stdClass#62 (2) {
  public $book =>
  array(2) {
    [0] =>
    string(1) "1"
    'page' =>
    string(1) "1"
  }
  public $book1 =>
  array(3) {
    'attribute:' =>
    array(2) {
      'test' =>
      string(1) "2"
      'test2' =>
      string(9) "testValue"
    }
    'page' =>
    string(1) "1"
    'page1' =>
    string(9) "testValue"
  }
}

```

Enjoy, guys!

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity59

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

Total

2

Last Release

3935d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3544388a2defce630d5b16fe9c38c91057278147939e8fac9a419386c3984a98?d=identicon)[kfosoft](/maintainers/kfosoft)

---

Top Contributors

[![nemed](https://avatars.githubusercontent.com/u/5604304?v=4)](https://github.com/nemed "nemed (3 commits)")

---

Tags

phpphp helperphp xmlxml helperphp xml helper

### Embed Badge

![Health badge](/badges/kfosoft-php-xml-helper/health.svg)

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

###  Alternatives

[imanghafoori/laravel-anypass

A minimal yet powerful package to help you in development.

21623.4k](/packages/imanghafoori-laravel-anypass)

PHPackages © 2026

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