PHPackages                             php-junior/laravel-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. php-junior/laravel-xml

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

php-junior/laravel-xml
======================

A simple XML to Array converter for Laravel

1.0.2(1y ago)312MITPHPPHP ^8.2

Since Oct 15Pushed 1y ago1 watchersCompare

[ Source](https://github.com/PHPJunior/laravel-xml)[ Packagist](https://packagist.org/packages/php-junior/laravel-xml)[ Docs](https://github.com/PHPJunior/laravel-xml)[ RSS](/packages/php-junior-laravel-xml/feed)WikiDiscussions main Synced 1mo ago

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

Simple XML to Array Converter
=============================

[](#simple-xml-to-array-converter)

[![Latest Version on Packagist](https://camo.githubusercontent.com/50a80e2c0dd54727fae7be69d21fe17e2667863475ed8b2d63672c6d89b4aeaf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7068702d6a756e696f722f6c61726176656c2d786d6c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/php-junior/laravel-xml)[![Total Downloads](https://camo.githubusercontent.com/887d21a42f878ae45e4d460e7ebd44715d5a4c6e13871ac3fe98fda80f1b68fc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7068702d6a756e696f722f6c61726176656c2d786d6c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/php-junior/laravel-xml)

This package is a simple XML to Array converter for Laravel.

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

[](#installation)

You can install the package via composer:

```
composer require php-junior/laravel-xml
```

Usage
-----

[](#usage)

default xml root tag is `root`

```
use Illuminate\Support\Arr;

$data = [
    'name' => 'John Doe',
    'description' => 'This is a description',
    'bio01' => 'This is a bio01',
    'bio02' => 'This is a bio02',
    'bio03' => 'This is a bio03',
    'bio04' => 'This is a bio04',
];

$xml = Arr::toXml($data);

    John Doe
    ...

// change root tag
$xml = Arr::toXml($data, 'user');

    John Doe
    ...

// cdata tag
$xml = Arr::toXml($data, 'user', ['description']);

    John Doe
    CDATA[This is a description]]>
    ...

// cdata wildcard tag
$xml = Arr::toXml($data, 'user', ['bio*']);

    John Doe
    CDATA[This is a bio01]]>
    CDATA[This is a bio02]]>
    CDATA[This is a bio03]]>
    CDATA[This is a bio04]]>

// multi-dimensional array
Arr::toXml([
    'user' => [
        [
            'name' => 'User',
            'email' => 'user@user.com'
        ],
        [
            'name' => 'User 2',
            'email' => 'user2@user.com'
        ],
    ]
], 'users');

        User
        user@user.com

        User 2
        user2@user.com

// xml to array
$data = Arr::fromXml($xml);
[
    'name' => 'John Doe',
    'description' => 'This is a description',
    'bio01' => 'This is a bio01',
    'bio02' => 'This is a bio02',
    'bio03' => 'This is a bio03',
    'bio04' => 'This is a bio04',
]
```

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

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

Total

3

Last Release

524d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e2695272c87c7144c984ddf468d380477dc578b617e7da5502eb4e7eff1f6087?d=identicon)[Nyi Nyi Lwin](/maintainers/Nyi%20Nyi%20Lwin)

---

Top Contributors

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

---

Tags

arraylaravelxmllaravelxmlarray-to-xmlxml-to-arraylaravel-xmlphp-junior

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/php-junior-laravel-xml/health.svg)

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

###  Alternatives

[veewee/xml

XML without worries

1835.9M29](/packages/veewee-xml)[ultrono/laravel-sitemap

Sitemap generator for Laravel 11, 12 and 13

36412.6k6](/packages/ultrono-laravel-sitemap)[bmatovu/laravel-xml

Laravel XML Support

91270.4k](/packages/bmatovu-laravel-xml)[tucker-eric/laravel-xml-middleware

A Laravel Middleware to accept XML requests

181.2M](/packages/tucker-eric-laravel-xml-middleware)[flowgistics/laravel-xml

1674.2k2](/packages/flowgistics-laravel-xml)

PHPackages © 2026

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