PHPackages                             idevman/xml-mapper - 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. idevman/xml-mapper

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

idevman/xml-mapper
==================

Used to map XMLs to mapped arrays

v2.0.1(6y ago)11.5k1[4 PRs](https://github.com/idevman/xml-mapper/pulls)MITPHP

Since May 26Pushed 4y agoCompare

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

READMEChangelogDependencies (3)Versions (12)Used By (0)

XML Mapper
==========

[](#xml-mapper)

[![Latest Stable Version](https://camo.githubusercontent.com/2a347f46e57f3c8e0bb91bc1ebf6ef738263ea06ec539d2255fcca8d0bc6052c/68747470733a2f2f706f7365722e707567782e6f72672f696465766d616e2f786d6c2d6d61707065722f762f737461626c65)](https://packagist.org/packages/idevman/xml-mapper)[![Total Downloads](https://camo.githubusercontent.com/775a6053b10fca9e00a46221611a57d6bba7a2d923aec9f9b27e6b685c03504b/68747470733a2f2f706f7365722e707567782e6f72672f696465766d616e2f786d6c2d6d61707065722f646f776e6c6f616473)](https://packagist.org/packages/idevman/xml-mapper)[![Latest Unstable Version](https://camo.githubusercontent.com/731f0479901d3bfeda6dc1437405b446c31262b10c303b51898b60d8e9e7966c/68747470733a2f2f706f7365722e707567782e6f72672f696465766d616e2f786d6c2d6d61707065722f762f756e737461626c65)](https://packagist.org/packages/idevman/xml-mapper)[![License](https://camo.githubusercontent.com/8b5bf556a26fb487f401a95e953ca687850bda307a67c7401b890b1c2cc23d5d/68747470733a2f2f706f7365722e707567782e6f72672f696465766d616e2f786d6c2d6d61707065722f6c6963656e7365)](https://packagist.org/packages/idevman/xml-mapper)[![composer.lock](https://camo.githubusercontent.com/1753ada442718737af06cb0372b0ccfcf5cd3ee432133e348d620b266dce711c/68747470733a2f2f706f7365722e707567782e6f72672f696465766d616e2f786d6c2d6d61707065722f636f6d706f7365726c6f636b)](https://packagist.org/packages/idevman/xml-mapper)

Create a mapped array from XML data using alias from MAP as laravel plugin.

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

[](#installation)

#### Dependencies:

[](#dependencies)

- [Laravel 6.2+](https://github.com/laravel/laravel) (v2.0.0)
- [Laravel 5.5+](https://github.com/laravel/laravel) (v1.0.4)

#### Installation:

[](#installation-1)

**-** Require the package via Composer

```
composer require idevman/xml-mapper
```

##### Laravel 5.5+

[](#laravel-55)

Laravel 5.5+ will autodiscover the package, for older versions add the following service provider

```
Idevman\XmlMapper\XmlMapperServiceProvider::class,
```

and alias

```
'XmlMapper' => 'Idevman\XmlMapper\Support\Facades\XmlMapper',
```

Usage
-----

[](#usage)

To use it lets assume xml content:

```

    Simple text
    Table
    Chair
    Door
    Window

```

So, load this in `$xml` variable and call liek this:

```
$response = XmlMapper::mapTo([
    'from' => '/note@from',
    'to' => '/note@to',
    'heading' => '/note/content@heading',
    'body' => '/note/content@body',
    'raw' => '/note/raw',
    'simpleItem' => '/note/item',
    'simpleItemNumber' => '/note/item@number',
    'allItems' => '/note/item[]',
    'allItemsNumber' => '/note/item[]@number',
], $xml);
```

And `$response` will contain

```
[
  "from" => "Tove"
  "to" => "Jani"
  "heading" => "Reminder"
  "body" => "Don't forget me this weekend!"
  "raw" => "Simple text"
  "simpleItem" => "Table"
  "simpleItemNumber" => "1"
  "allItems" => [
    0 => "Table"
    1 => "Chair"
    2 => "Door"
    3 => "Window"
  ]
  "allItemsNumber" => [
    0 => "1"
    1 => "2"
    2 => "3"
    3 => "4"
  ]
]
```

Grouping attribute nodes
------------------------

[](#grouping-attribute-nodes)

Lets assuma same XML and load this in `$xml` variable and call like this:

```
$response = XmlMapper::mapTo([
    'addressing[from,to]' => '/note[@from,@to]',
    'content[header,body]' => '/note/content[@heading,@body]',
    'items[sequence,value]' => '/note/item[][@number,@value]',
], $xml);
```

And `$response` will contain this result:

```
[
  "addressing" => [
    "from" => "Tove"
    "to" => "Jani"
  ]
  "content" => [
    "header" => "Reminder"
    "body" => "Don't forget me this weekend!"
  ]
  "items" => [
    [
      "sequence" => "1"
      "value" => "50"
    ],
    [
      "sequence" => "2"
      "value" => "40"
    ],
    [
      "sequence" => "3"
      "value" => "30"
    ],
    [
      "sequence" => "4"
      "value" => "60"
    ]
  ]
]
```

Note that labeling change according key array content

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 60% 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 ~51 days

Recently: every ~76 days

Total

7

Last Release

2237d ago

Major Versions

v1.0.4 → v2.0.02019-12-29

### Community

Maintainers

![](https://www.gravatar.com/avatar/3a89b1411257541b9045e950b575735ab52e319f45844d53de4748cbe4fde912?d=identicon)[isc.sirius](/maintainers/isc.sirius)

---

Top Contributors

[![idevman](https://avatars.githubusercontent.com/u/50961657?v=4)](https://github.com/idevman "idevman (6 commits)")[![jesus-ildefonso](https://avatars.githubusercontent.com/u/189699786?v=4)](https://github.com/jesus-ildefonso "jesus-ildefonso (4 commits)")

---

Tags

laravelxmlmapping

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[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)
