PHPackages                             d-shorkin/arrayable-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. d-shorkin/arrayable-xml

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

d-shorkin/arrayable-xml
=======================

PHP library for parsing XML to array with laravel support

1.0.3(6y ago)2675MITPHPPHP &gt;=7.0.0CI failing

Since Sep 11Pushed 6y ago1 watchersCompare

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

READMEChangelog (4)Dependencies (3)Versions (5)Used By (0)

Arrayable XML
=============

[](#arrayable-xml)

PHP library for parsing XML to array. This library can formatting attributes of xml

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

[](#installation)

Install via composer:

```
composer require d-shorkin/arrayable-xml
```

Usage
-----

[](#usage)

```
$xmlString =
  string(3) "bar"
  ["children"]=>
  array(1) {
    ["example"]=>
    array(2) {
      [0]=>
      array(2) {
        ["testAttr"]=>
        string(3) "foo"
        ["text"]=>
        string(1) "1"
      }
      [1]=>
      array(1) {
        ["text"]=>
        string(1) "2"
      }
    }
  }
}

```

Laravel
-------

[](#laravel)

If you does not use `php artisan package:discover` command. You need add `ArrayableXmlProvider` to config.

`config/app.php`

```
'providers' => [
    // ...

    Dshorkin\ArrayableXml\Laravel\ArrayableXmlProvider::class,
],

'aliases' => [
    // ...

    'ArrayableXml' => Dshorkin\\ArrayableXml\Laravel\ArrayableXml::class
]
```

Basic laravel usage:

```
ArrayableXml::create($xmlString)->toArray()
```

Class reference
---------------

[](#class-reference)

Dshorkin\\ArrayableXml\\ArrayableXmlFactory

#### Create

[](#create)

```
ArrayableXmlFactory::create(string $str, [string $childrenFieldKey, [string $textFieldKey, [bool $miniElements]]]): ArrayableXmlInterface

```

ParamTypeDefaultDescriptionstrstringXML stringchildrenFieldKeystringchildrenParse child nodes in children property, if you send empty string child nodes will be merge with attributestextFieldKeystringtextText content will be parse in property with this keyminiElementsbooltrueIf you disable it all elements will be return array of children. By default if parent has single child that will be returned alone#### Create From SimpleXmlElement

[](#create-from-simplexmlelement)

```
ArrayableXmlFactory::createFromSimpleXmlElement(\SimpleXMLElement $xml, [string $childrenFieldKey, [string $textFieldKey, [bool $miniElements]]]): ArrayableXmlInterface

```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

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

Total

4

Last Release

2431d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/32be798a1f06cbca2782decfdc7ef5eb0a2615f2a7813ee0935748cfba42fac4?d=identicon)[d-shorkin](/maintainers/d-shorkin)

---

Top Contributors

[![d-shorkin](https://avatars.githubusercontent.com/u/10565025?v=4)](https://github.com/d-shorkin "d-shorkin (8 commits)")

---

Tags

laravelxmlarrayxml-to-arrayconvent

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/d-shorkin-arrayable-xml/health.svg)

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

###  Alternatives

[iteks/laravel-enum

A comprehensive Laravel package providing enhanced enum functionalities, including attribute handling, select array conversions, and fluent facade interactions for robust enum management in Laravel applications.

2516.7k](/packages/iteks-laravel-enum)

PHPackages © 2026

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