-
Notifications
You must be signed in to change notification settings - Fork 3
Example: Mount list (mounts.xml)
Chris edited this page May 26, 2016
·
2 revisions
The parser implementation (pandaac\Exporter\Parsers\Mounts in this case) has no options.
use pandaac\Exporter\Exporter;
use pandaac\Exporter\Parsers\Mounts;
try {
$mounts = new Exporter(
'./data/XML/mounts.xml',
new Mounts
);
$response = $mounts->export();
} catch (Exception $e) {
// Log errors...
}The export() method returns a Illuminate\Support\Collection object, please refer to its documentation. If you would prefer a JSON or an array response however, you may do as follows...
$response = $mounts->export()->toJson();$response = $mounts->export()->toArray();[
{
"id": 1,
"clientid": 368,
"name": "Widow Queen",
"speed": 20,
"premium": "yes"
},
{
"id": 2,
"clientid": 369,
"name": "Racing Bird",
"speed": 20,
"premium": "yes"
},
{
"id": 3,
"clientid": 370,
"name": "War Bear",
"speed": 20,
"premium": "yes"
},
{
"id": 4,
"clientid": 371,
"name": "Black Sheep",
"speed": 20,
"premium": "yes"
},
{
"id": 5,
"clientid": 372,
"name": "Midnight Panther",
"speed": 20,
"premium": "yes"
},
{
"id": 6,
"clientid": 373,
"name": "Draptor",
"speed": 20,
"premium": "yes"
},
{
"id": 7,
"clientid": 374,
"name": "Titanica",
"speed": 20,
"premium": "yes"
},
{
"id": 8,
"clientid": 375,
"name": "Tin Lizzard",
"speed": 20,
"premium": "yes"
},
{
"id": 9,
"clientid": 376,
"name": "Blazebringer",
"speed": 20,
"premium": "yes"
},
{
"id": 10,
"clientid": 377,
"name": "Rapid Boar",
"speed": 20,
"premium": "yes"
},
{
"id": 11,
"clientid": 378,
"name": "Stampor",
"speed": 20,
"premium": "yes"
},
{
"id": 12,
"clientid": 379,
"name": "Undead Cavebear",
"speed": 20,
"premium": "yes"
},
{
"id": 13,
"clientid": 387,
"name": "Donkey",
"speed": 20,
"premium": "yes"
},
{
"id": 14,
"clientid": 388,
"name": "Tiger Slug",
"speed": 20,
"premium": "yes"
},
{
"id": 15,
"clientid": 389,
"name": "Uniwheel",
"speed": 20,
"premium": "yes"
},
{
"id": 16,
"clientid": 390,
"name": "Crystal Wolf",
"speed": 20,
"premium": "yes"
},
{
"id": 17,
"clientid": 392,
"name": "Brown War Horse",
"speed": 20,
"premium": "yes"
},
{
"id": 18,
"clientid": 401,
"name": "Kingly Deer",
"speed": 20,
"premium": "yes"
},
{
"id": 19,
"clientid": 402,
"name": "Tamed Panda",
"speed": 20,
"premium": "yes"
},
{
"id": 20,
"clientid": 405,
"name": "Dromedary",
"speed": 20,
"premium": "yes"
},
...
]