XML Document Parser for Laravel and PHP

v4.0.0 2019-08-28 10:07 UTC


Parser Component is a framework agnostic package that provide a simple way to parse XML to array without having to write a complex logic.

Build Status Latest Stable Version Total Downloads Latest Unstable Version License Coverage Status

Imagine if you can parse

    <user followers="5">


$user = [
    'id' => '1',
    'email' => 'crynobone@gmail.com',
    'followers' => '5'

by just writing this:

use Orchestra\Parser\Xml\Facade as XmlParser;

$xml = XmlParser::load('path/to/above.xml');
$user = $xml->parse([
    'id' => ['uses' => 'user.id'],
    'email' => ['uses' => 'user.email'],
    'followers' => ['uses' => 'user::followers'],

Table of Content

Version Compatibility

Laravel Parser
5.5.x 3.5.x
5.6.x 3.6.x
5.7.x 3.7.x
5.8.x 3.8.x
6.x 4.x


To install through composer, simply put the following in your composer.json file:

    "require": {
        "orchestra/parser": "^4.0"

And then run composer install from the terminal.

Quick Installation

Above installation can also be simplify by using the following command:

composer require "orchestra/parser=^4.0"


Next add the service provider in config/app.php.

'providers' => [

    // ...



You might want to add Orchestra\Parser\Xml\Facade to class aliases in config/app.php:

'aliases' => [

    // ...

    'XmlParser' => Orchestra\Parser\Xml\Facade::class,