MNB PHPExcelDeveloper Guide
XLS module

XLS Module

Install and use the fully independent native BIFF8 reader and writer for Excel 97–2003 .xls files.

Updated

LevelBeginnerReading time8 minPackagemnb/mnb-phpexcel
Xls::read()Xls::write()XlsReader::sheetNames()

What you will learn

  • Install native XLS support without an external spreadsheet engine.
  • Understand the OLE/CFB and BIFF8 layers handled by the package.
  • Choose XLS or XLSX based on compatibility and feature requirements.

Install the native XLS module#

Terminal
composer require mnb/mnb-phpexcel:^2.0

The module requires PHP 8.1+, ext-iconv, and Core. It does not require, suggest, wrap, detect, or call PhpSpreadsheet.

Use the package-local facade#

PHP
use Mnb\PHPExcel\Format\Xls;

$rows = Xls::read('report.xls')
    ->sheet('Data')
    ->withHeaderRow()
    ->toArray();

Xls::write($rows, 'report-copy.xls', [
    'with_header' => true,
    'sheet_name' => 'Data',
]);

Understand the native architecture#

LayerResponsibility
OLE Compound File BinaryReads and writes the container header, FAT, DIFAT, MiniFAT, directory entries, normal streams, and mini streams.
BIFF8 workbook globalsReads sheet metadata, shared strings, formats, styles, date system, and worksheet offsets.
BIFF8 worksheet streamsReads and writes rows, cells, formulas, merges, dimensions, and pane settings.
Core ReadSessionProvides headers, projection, limits, row iteration, arrays, chunks, and normalized errors.

Choose XLS deliberately#

FormatUse it when
XLSAn existing Excel 97–2003 integration requires BIFF8, or a partner system cannot accept XLSX.
XLSXYou need modern workbook features, more rows and columns, Office password encryption, charts, pivots, media, comments, or advanced styling.
CSVOnly tabular values matter and the receiving system does not need workbook structure.