PHP code example of pandaac / exporter

1. Go to this page and download the library: Download pandaac/exporter library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

pandaac / exporter example snippets


use Exception;
use pandaac\Exporter\Parsers;
use pandaac\Exporter\Exporter;

try {
    $exporter = new Exporter('/home/pandaac/theforgottenserver');

    $response = $exporter->parse(new Parsers\Weapons);
} catch (Exception $e) {
    // Handle exceptions as you see fit...
}

$exporter = new Exporter('/home/pandaac/theforgottenserver', $settings);

$settings = [
    'xml' => [
        // The XML engine will automatically validate any file it tries to parse,
        // and if the data is invalid, an exception will be thrown. You may
        // disable this behaviour by setting `validate` to `false`.
        'validate' => true,

        // The XML engine will not throw exceptions on missing files when
        // parsing through a recursive structure. You may enable this
        // behaviour by setting `strict` to `true`.
        'strict' => false,
    ],
]

   $exporter->parse(new \pandaac\Exporter\Parsers\Actions);
   

   $exporter->parse(new \pandaac\Exporter\Parsers\ChatChannels);
   

   $exporter->parse(new \pandaac\Exporter\Parsers\Commands);
   

   $exporter->parse(new \pandaac\Exporter\Parsers\CreatureScripts);
   

   $exporter->parse(new \pandaac\Exporter\Parsers\Events);
   

   $exporter->parse(new \pandaac\Exporter\Parsers\GlobalEvents);
   

   $exporter->parse(new \pandaac\Exporter\Parsers\Groups);
   

   $exporter->parse(new \pandaac\Exporter\Parsers\Items);
   

   $exporter->parse(new \pandaac\Exporter\Parsers\MapHouses, [], 'forgotten-house.xml');
   

   $exporter->parse(new \pandaac\Exporter\Parsers\MapSpawns, [], 'forgotten-spawn.xml');
   

   $exporter->parse(new \pandaac\Exporter\Parsers\Monster, [], 'Demons/Demon.xml');
   

   $exporter->parse(new \pandaac\Exporter\Parsers\Monsters, [ 'recursive' => true ]);
   

   $exporter->parse(new \pandaac\Exporter\Parsers\Mounts);
   

   $exporter->parse(new \pandaac\Exporter\Parsers\Movements);
   

   $exporter->parse(new \pandaac\Exporter\Parsers\NPC, [], 'The Oracle.xml');
   

   $exporter->parse(new \pandaac\Exporter\Parsers\Outfits);
   

   $exporter->parse(new \pandaac\Exporter\Parsers\Quests);
   

   $exporter->parse(new \pandaac\Exporter\Parsers\Raid, [], 'testraid.xml');
   

   $exporter->parse(new \pandaac\Exporter\Parsers\Raids, [ 'recursive' => true ]);
   

   $exporter->parse(new \pandaac\Exporter\Parsers\Spells);
   

   $exporter->parse(new \pandaac\Exporter\Parsers\Stages);
   

   $exporter->parse(new \pandaac\Exporter\Parsers\TalkActions);
   

   $exporter->parse(new \pandaac\Exporter\Parsers\Vocations);
   

   $exporter->parse(new \pandaac\Exporter\Parsers\Weapons);
   

   use pandaac\Exporter\Parsers\XMLSource;
   use pandaac\Exporter\Sources\StringContent;

   $exporter->parse(new XMLSource(
       new StringContent('<online><player id="1" /><player id="2" /></online>')
   ));
   

   $exporter->parse(new \pandaac\Exporter\Parsers\Towns);