XLSX library
Native XLSX reading, writing, row streaming, formulas, styles, charts and AES-256 workbook security.
mnb/mnb-phpexcel-xlsx:^2.0Main package · PHP 8.1+ · Framework-neutral
Install one main package to read, write, stream, validate and import spreadsheet data. MNB PHPExcel brings XLSX, XLS, CSV, JSON, XML, ODS and database workflows together behind one consistent PHP API.
composer require mnb/mnb-phpexcel:^2.0
Main package features
Each capability below belongs to a distinct workflow. Open the focused guide when you need implementation details, options and production notes.
Inspect workbooks, select sheets, map headers and access rows, columns, ranges and cells.
Generate XLSX reports with worksheets, formulas, styles, images, charts and browser downloads.
Process rows forward-only, select required columns and handle chunks with bounded memory.
Map spreadsheet columns, validate records, preview changes and insert or update PDO data.
Use upload checks, formula-injection protection, worksheet protection and AES-256 encryption.
Move legacy spreadsheet workflows to typed PHP 8 APIs with explicit migration guidance.
Practical PHP examples
Four focused examples cover the main workflows without repeating the feature list. Each tab links to a complete tutorial with expected output and error handling.
<?php
require __DIR__ . '/vendor/autoload.php';
use Mnb\PHPExcel\MnbExcel;
$sheet = MnbExcel::read('orders.xlsx')
->sheet('Orders')
->withHeaderRow(1);
foreach ($sheet->rows() as $row) {
echo $row['Order ID'] . PHP_EOL;
}<?php
use Mnb\PHPExcel\MnbExcel;
MnbExcel::largeRead('orders.xlsx')
->sheet('Orders')
->withHeader()
->onlyColumns(['A', 'B', 'F'])
->chunk(1000, function (array $rows): void {
processRows($rows);
});<?php
use Mnb\PHPExcel\MnbExcel;
MnbExcel::report($rows)
->withHeader()
->currencyColumns(['Amount'], '$')
->freezeHeader()
->autoFilter()
->autoWidth()
->save('sales-report.xlsx');<?php
use Mnb\PHPExcel\MnbExcel;
$result = MnbExcel::importProducts(
'products.xlsx',
$pdo,
'products',
[
'duplicate_strategy' => 'update',
'unique_by' => ['sku'],
'batch_size' => 1000,
]
);Individual libraries
The complete mnb/mnb-phpexcel package is recommended for most applications. Individual packages keep smaller projects focused while preserving the same documented conventions.
One dependency for all documented formats, database tools and application workflows.
Native XLSX reading, writing, row streaming, formulas, styles, charts and AES-256 workbook security.
mnb/mnb-phpexcel-xlsx:^2.0Independent BIFF8 and OLE/CFB support for legacy Excel 97–2003 workbook reading and writing.
mnb/mnb-phpexcel-xls:^2.0Streaming CSV and TSV input and output with delimiter detection, encoding conversion and injection protection.
mnb/mnb-phpexcel-csv:^2.0Read and write JSON, JSON Lines and NDJSON, including streamed arrays and workbook-shaped payloads.
mnb/mnb-phpexcel-json:^2.0Forward-only XML processing with secure parser defaults, schema mapping and configurable output.
mnb/mnb-phpexcel-xml:^2.0Native OpenDocument Spreadsheet reading with worksheet selection, projection, dates and formulas.
mnb/mnb-phpexcel-ods:^2.0Format-neutral PDO imports with mapping, validation, domain presets, batches and failed-row reporting.
mnb/mnb-phpexcel-database:^2.0Stream large XLSX worksheets directly into PDO with chunks, resumable manifests and failure output.
mnb/mnb-phpexcel-database-xlsx:^2.0Main package architecture
The complete mnb/mnb-phpexcel distribution connects the format engines, database tools and application workflows documented across this site. Use the main facade for a consistent API while each library remains independently documented and installable.
PHP Excel library FAQ
Quick guidance for PHP developers choosing a spreadsheet library, processing large XLSX files, importing workbook data or replacing legacy PHPExcel code.
MNB PHPExcel is an MIT-licensed PHP Excel library for reading, writing, streaming, validating and importing XLSX, XLS, CSV, JSON, XML and ODS data through a modern PHP 8.1+ API.
Yes. Use forward-only row iteration, selected-column projection or chunk processing. Start with the memory-efficient XLSX reader guide.
Yes. The database workflow covers header mapping, validation, previews, dry runs, batched PDO inserts, updates and failed-row reporting. See the Excel-to-MySQL use case.
The current documentation targets PHP 8.1 and later, with typed APIs and Composer installation through mnb/mnb-phpexcel.
It provides modern spreadsheet workflows for PHP 8, but the APIs are not drop-in identical. Use the migration guide to map legacy patterns deliberately.
Developer ecosystem
Documentation for MNB PHPExcel v2.0.6
Find guides, packages, methods, and examples.
↑↓ move · Enter open · Esc close