Skip to content
MNB PHPExcelDeveloper Guide
AI
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#

Use the right XML API#

TaskPrimary APIChoose it when
Read normalized XML rowsXml::read()You need a package-local row session with sheet/row tags, type inference, limits, headers, or projection.
Write row-oriented XMLXml::write()Application rows should become controlled XML with explicit root and row element names.
Map an external schemaXmlSchemaMapping::from()Vendor XML element paths or attributes must map into stable application columns.
Return XML as a stringXmlWriter::payloadToString()An API or application layer needs XML output without writing a file first.

What the standalone XML package covers#

Read

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
Map & write

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
Security

Secure parser defaults

  • External network access disabled by default
  • DOCTYPE rejected unless explicitly enabled
  • Bounded depth and source-size controls
  • ext-xmlreader streaming 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.