MNB PHPExcelDeveloper Guide

XML · Reading

XML reading examples.

Package-local, copy-ready examples organized like the classes and methods reference. Open one example at a time, search by method, and jump from the right-side index.

Packagemnb/mnb-phpexcel-xml:^2.0Reference2 examples · 6 methods
XML individual library

Reading examples with copy-ready, production-minded PHP.

Every snippet uses mnb/mnb-phpexcel-xml or its declared Core dependency. Each copied snippet includes strict typing, a concise summary, implementation guidance, readable limits, and a safe fixture check.

2
examples
6
documented methods
Example 01

Read repeated XML row elements

Open related guide
Xml::read()withHeaderRow()streaming()rows()
read-repeated-xml-row-elements.php
<?php

declare(strict_types=1);

/*
Summary:
    Stream one repeated element type into normalized associative rows.

Implementation note:
    The reader uses secure parser defaults. Keep explicit row tags and source limits for external
    XML contracts.
*/

use Mnb\PHPExcel\Format\Xml;

$rows = Xml::read(__DIR__ . '/orders.xml', [
    'row_tag' => 'order',
    'infer_types' => true,
    'max_source_rows' => 100_000,
])->withHeaderRow(1)->streaming()->rows();