New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

laravie/parser

XML Document Parser for PHP
2,266,825 230
Install
composer require laravie/parser
Latest Version:v3.0.0
PHP:^8.2
Laravel:10 · 11 · 12
Older releases:5 · 8 · 9
License:MIT
Last Updated:Feb 2, 2025
Links: GitHub  ·  Packagist
Maintainer: crynobone

XML Document Parser PHP

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

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

Imagine if you can parse

<api>
    <user followers="5">
        <id>1</id>
        <email>crynobone@gmail.com</email>
    </user>
</api>

to

<?php

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

by just writing this:

<?php

use Laravie\Parser\Xml\Reader;
use Laravie\Parser\Xml\Document;

$xml = (new Reader(new Document()))->load('path/to/above.xml');

$user = $xml->parse([
    'id' => ['uses' => 'user.id'],
    'email' => ['uses' => 'user.email'],
    'followers' => ['uses' => 'user::followers'],
]);

Installation

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

{
    "require": {
        "laravie/parser": "^2.0"
    }
}

And then run composer install from the terminal.

Quick Installation

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

composer require "laravie/parser=^2.0"

Related Packages

nathanmac/parser

Simple PHP Parser Utility Library for API Development

1,024,129 210
peterdkc/parser

Simple PHP Parser Utility Library for API Development

2,540 2
orchestra/parser

XML Document Parser for Laravel and PHP

1,839,851 460
phanan/poddle

Parse podcast feeds with PHP following PSP-1 Podcast RSS Standard

52,239 19
vdhicts/keepachangelog-parser

Parser for the Keep A Changelog standard

13,666 4

Version History

Version Released PHP Laravel License
v3.0.0 ^8.2 ^10.0 || ^11.0 || ^12.0 MIT
v2.4.0 ^7.3 || ^8.0 ^8.0 || ^9.0 || ^10.0 || ^11.0 MIT
v2.3.0 ^7.3 || ^8.0 ^8.0 || ^9.0 || ^10.0 MIT
v2.2.0 ^7.3 || ^8.0 ^8.0 || ^9.0 MIT
v2.1.5 ^7.3 || ^8.0 ^8.0 MIT