PHP code example of alex.oleshkevich / fast-xml-parser

1. Go to this page and download the library: Download alex.oleshkevich/fast-xml-parser 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/ */

    

alex.oleshkevich / fast-xml-parser example snippets



declare(strict_types=1);

nericHandler;
use FastXml\Parser;


// create callback handler
$handler = new GenericHandler;

// set "on item parsed" callback
$handler->setOnItemParsedCallback(function ($item) use ($self) {
    // do smth with parsed item
});

// set "on progress" callback
$handler->setOnProgressCallback(function ($bytesProcessed, $bytesTotal) use ($self) {
    // eg. draw a progress bar
});

// instantiate
$parser = new Parser($handler);

// define tags which you don't want to