Skip to content

PHP 8.1+ · Open source · Spreadsheet library

MNB PHPExcel — modern spreadsheet tools for PHP.

MNB PHPExcel reads, writes, validates and streams XLSX, XLS, CSV/TSV, JSON, XML and ODS from one PHP 8.1+ API. Use the full package for mixed-format workflows and database imports, or install a focused package when one format owns the job.

  • Large-file streamingForward-only reads and chunked processing.
  • Validation & importsInspect uploads before application or PDO writes.
  • Modular packagesInstall the toolkit or only the format you need.
composer require mnb/mnb-phpexcel:^2.0
PHP 8.1+Built for current PHP applications.
8 focused packagesUse the full toolkit or one responsibility.
Streaming-firstLarge-file workflows can stay bounded in memory.
Reproducible evidenceBenchmarks · GitHub · Packagist

The API keeps the important steps visible.

Select the workbook, choose the worksheet, declare where the headers live, then iterate records. The example is intentionally ordinary: application code should be easy to read six months later.

read-orders.php
<?php

require __DIR__ . '/vendor/autoload.php';

use Mnb\PHPExcel\MnbExcel;

$orders = MnbExcel::read('orders.xlsx')
    ->sheet('Orders')
    ->withHeaderRow(1);

foreach ($orders->rows() as $row) {
    echo $row['Order ID'] . ' — ' . $row['Customer'] . PHP_EOL;
}

Choose the right package in a clean, easy-to-scan format.

mnb/mnb-phpexcel is the practical default when an application touches several formats. Pick a focused package when one format or one import responsibility has a clear boundary.

Package Description Install (Composer) Get started
Excel 2007+

XLSX library

For modern .xlsx reports and imports.

Native Excel 2007+ reading and writing with streaming, formulas, styling and workbook protection.

mnb/mnb-phpexcel-xlsx:^2.0
Legacy Excel

XLS library

For older .xls spreadsheets still in use.

Support classic Excel 97–2003 workbooks through BIFF8 and OLE/CFB readers and writers.

mnb/mnb-phpexcel-xls:^2.0
CSV + TSV

CSV library

For delimited data exchange and pipelines.

Low-memory CSV and TSV handling with delimiter control, encoding conversion and output safeguards.

mnb/mnb-phpexcel-csv:^2.0
JSON + NDJSON

JSON library

For API-facing data and line streams.

Read and write JSON arrays, workbook-shaped documents, JSON Lines and NDJSON streams.

mnb/mnb-phpexcel-json:^2.0
Secure XML

XML library

For XML feeds and mapped imports.

Secure, forward-only XML processing with explicit mapping and configurable structured output.

mnb/mnb-phpexcel-xml:^2.0
OpenDocument

ODS library

For LibreOffice and ODS workflows.

OpenDocument spreadsheet support with worksheet selection, column projection, dates and formulas.

mnb/mnb-phpexcel-ods:^2.0
PDO imports

Database library

For database-first spreadsheet imports.

Map and validate iterable rows before batched PDO inserts, updates and failed-row reporting.

mnb/mnb-phpexcel-database:^2.0
XLSX → PDO

Database XLSX

For heavy XLSX-to-database jobs.

Stream very large XLSX worksheets directly into PDO with chunks, manifests and failure output.

mnb/mnb-phpexcel-database-xlsx:^2.0

A few details that affect real projects.

These are the questions that usually change an implementation choice. The answers are intentionally short; the reference pages carry the edge cases.

Do I need the complete package?

Not always. Use the complete package when one application works across several formats or combines spreadsheet handling with database imports. A focused package is a better fit for a service that only owns one format.

How are formulas handled?

Writers can create formula cells. Readers can expose formula expressions and, where the format supports it, calculated or cached results. Unsupported calculations should fall back to cached values or an application-specific calculation step rather than being guessed.

Can the database layer stay separate from file parsing?

Yes. The Database package works with mapped iterable rows, so validation and PDO logic do not have to depend on a particular spreadsheet format. Database XLSX is available when the job is specifically a large XLSX-to-PDO pipeline.

Is migration from the old PHPExcel project automatic?

No. The current API is designed for PHP 8.1+ and does not pretend to be a drop-in compatibility layer. Existing code should be migrated by mapping workbook, reader and writer responsibilities explicitly.