Skip to content
MNB PHPExcelDeveloper Guide
AI

Getting started

Install PHP Excel Library and Check the Environment

Install PHP Excel library packages with Composer, configure XAMPP, and verify the PHP runtime before writing spreadsheet code.

Level
Beginner
Reading time
8 min
Package
mnb/mnb-phpexcel
Updated
PHP 8.1+Full packageComposer
MnbExcel::version()MnbExcel::environmentCheck()

Install the main package#

Install the main package used throughout this documentation. It includes the MnbExcel facade, native XLSX and XLS support, CSV, JSON, XML, ODS reading, database tools, large-file workflows, and application services.

Terminal
composer require mnb/mnb-phpexcel:^2.0

Configure XAMPP for development#

  1. Open php.ini

    In XAMPP Control Panel, select Config → PHP (php.ini).

  2. Enable recommended extensions

    Enable openssl, zip, xmlreader, mbstring, iconv, and the PDO driver used by your database.

  3. Restart Apache

    PHP configuration changes are loaded only after Apache restarts.

  4. Check the command-line PHP

    Make sure the terminal and Apache use the intended PHP installation.

Terminal
php -v
php -m

Verify Composer autoloading#

check-environment.php
<?php

declare(strict_types=1);

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

use Mnb\PHPExcel\MnbExcel;

printf("MNB PHPExcel %s\n", MnbExcel::version());
print_r(MnbExcel::environmentCheck());
Example shape
MNB PHPExcel 2.0.6
Array
(
    [php] => ...
    [xlsx] => ...
)

Use a predictable project layout#

Recommended layout
my-project/
├── composer.json
├── vendor/
├── public/
│   └── index.php
├── storage/
│   ├── imports/
│   ├── exports/
│   ├── queue/
│   └── temporary/
└── src/

Keep uploaded and generated workbooks outside the public web root. Serve downloads through controlled PHP responses.