Standalone XML package
PHP XML Library for Secure Streaming & Schema Mapping
Use the standalone MNB PHPExcel XML package for secure forward-only XML workflows that need row streaming, logical sheets, schema mapping, bounded parsing, or configurable XML output.
Composer
composer require mnb/mnb-phpexcel-xml:^2.0- Package
mnb/mnb-phpexcel-xml- Entry API
Mnb\PHPExcel\Format\Xml- Runtime
- PHP 8.1+
- Format
- .xml · streaming XML
Choose your XML workflow#
01
Stream XML rows safelySelect row and sheet elements, infer scalar values, normalize headers, and process repeated XML records forward-only.
Reading guide →02Write controlled XML outputChoose root, row, sheet, element naming, pretty-printing, and structured output behavior explicitly.
Writing guide →03Map external XML schemasTranslate source element paths and attributes into canonical application columns without coupling business code to vendor XML shapes.
Schema mapping →04Review security and capability boundariesCheck parser defaults, limits, streaming behavior, schema support, and writer features before deployment.
Feature matrix →Use the right XML API#
| Task | Primary API | Choose it when |
|---|---|---|
| Read normalized XML rows | Xml::read() | You need a package-local row session with sheet/row tags, type inference, limits, headers, or projection. |
| Write row-oriented XML | Xml::write() | Application rows should become controlled XML with explicit root and row element names. |
| Map an external schema | XmlSchemaMapping::from() | Vendor XML element paths or attributes must map into stable application columns. |
| Return XML as a string | XmlWriter::payloadToString() | An API or application layer needs XML output without writing a file first. |
What the standalone XML package covers#
Forward-only XML processing
- Repeated row elements and logical sheets
- Header normalization and column projection
- Scalar inference, trimming and null conversion
- File, row and nesting-depth boundaries
Explicit schema and output control
- External schema mapping into canonical columns
- Configurable root, sheet, row and field elements
- Workbook-style or row-oriented output
- Sanitized element names and string payload output
Secure parser defaults
- External network access disabled by default
- DOCTYPE rejected unless explicitly enabled
- Bounded depth and source-size controls
ext-xmlreaderstreaming with portable fallback support
Package boundary: this guide uses Mnb\PHPExcel\Format\Xml from mnb/mnb-phpexcel-xml. Install the focused XML library or the monolithic mnb/mnb-phpexcel package for a project, not both.
Was this guide useful?Use GitHub issues for corrections, missing examples, or unclear behavior.
Open an issue