| Package Data | |
|---|---|
| Maintainer Username: | crynobone |
| Maintainer Contact: | crynobone@gmail.com (Mior Muhammad Zaki) |
| Package Create Date: | 2014-04-29 |
| Package Last Update: | 2025-03-01 |
| Home Page: | |
| Language: | PHP |
| License: | MIT |
| Last Refreshed: | 2025-10-26 03:02:43 |
| Package Statistics | |
|---|---|
| Total Downloads: | 1,637,691 |
| Monthly Downloads: | 20,235 |
| Daily Downloads: | 122 |
| Total Stars: | 457 |
| Total Watchers: | 17 |
| Total Forks: | 47 |
| Total Open Issues: | 0 |
Parser Component is a framework agnostic package that provide a simple way to parse XML to array without having to write a complex logic.
Imagine if you can parse
<api>
<user followers="5">
<id>1</id>
<email>crynobone@gmail.com</email>
</user>
</api>
to
$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'],
]);
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
To install through composer, simply put the following in your composer.json file:
{
"require": {
"orchestra/parser": "^3.5"
}
}
And then run composer install from the terminal.
Above installation can also be simplify by using the following command:
composer require "orchestra/parser=^3.5"
Next add the service provider in config/app.php.
'providers' => [
// ...
Orchestra\Parser\XmlServiceProvider::class,
],
You might want to add Orchestra\Parser\Xml\Facade to class aliases in config/app.php:
'aliases' => [
// ...
'XmlParser' => Orchestra\Parser\Xml\Facade::class,
],