Skip to content

Example: Group list (groups.xml)

Chris edited this page Feb 15, 2017 · 2 revisions

DEPRECATED!

This wiki page has been deprecated and refers to version 1.0 of the project. Please refer to the main README for the latest documentation.


Options

The parser implementation (pandaac\Exporter\Parsers\Groups in this case) has no options.

Example

use pandaac\Exporter\Exporter;
use pandaac\Exporter\Parsers\Groups;

try {

  $groups = new Exporter(
    './data/XML/groups.xml',
    new Groups
  );

  $response = $groups->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 = $groups->export()->toJson();
$response = $groups->export()->toArray();

Example output (JSON)

[
  {
    "id": 1,
    "name": "player",
    "flags": 0,
    "access": 0,
    "maxdepotitems": 0,
    "maxvipentries": 0
  },
  {
    "id": 2,
    "name": "gamemaster",
    "flags": 137438953471,
    "access": 1,
    "maxdepotitems": 0,
    "maxvipentries": 200
  },
  {
    "id": 3,
    "name": "god",
    "flags": 272730398714,
    "access": 1,
    "maxdepotitems": 0,
    "maxvipentries": 200
  },

  ...
]

Clone this wiki locally