MNB PHPExcelDeveloper Guide

XLS · Basic

XLS basic examples.

Package-local, copy-ready examples organized like the classes and methods reference. Open one example at a time, search by method, and jump from the right-side index.

Packagemnb/mnb-phpexcel-xls:^2.0Reference2 examples · 4 methods
XLS individual library

Basic examples with copy-ready, production-minded PHP.

Every snippet uses mnb/mnb-phpexcel-xls or its declared Core dependency. Each copied snippet includes strict typing, a concise summary, implementation guidance, readable limits, and a safe fixture check.

2
examples
4
documented methods
Example 01

Write associative rows to XLS

Open related guide
Xls::write()
write-associative-rows-to-xls.php
<?php

declare(strict_types=1);

/*
Summary:
    Generate a native Excel 97–2003 workbook with a header row and named worksheet.

Implementation note:
    Use XLS only when a legacy integration requires BIFF8. Choose XLSX for modern capacity and
    richer presentation features.
*/

use Mnb\PHPExcel\Format\Xls;

Xls::write([
    ['Name' => 'Alice', 'Amount' => 1250.50, 'Approved' => true],
    ['Name' => 'Bob', 'Amount' => 875.00, 'Approved' => false],
], __DIR__ . '/report.xls', [
    'with_header' => true,
    'sheet_name' => 'Data',
]);