Installation and Environment Check
Install the main package, configure XAMPP, and verify the runtime before writing code.
Updated
MnbExcel::version()MnbExcel::environmentCheck()What you will learn
- Install the main package with Composer.
- Enable the useful XAMPP extensions.
- Verify autoloading and runtime capabilities.
Before you start
- PHP 8.1 or newer.
- Composer available from the terminal.
- A writable PHP project directory.
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.
composer require mnb/mnb-phpexcel:^2.0Configure XAMPP for development#
- Open php.ini
In XAMPP Control Panel, select Config → PHP (php.ini).
- Enable recommended extensions
Enable
openssl,zip,xmlreader,mbstring,iconv, and the PDO driver used by your database. - Restart Apache
PHP configuration changes are loaded only after Apache restarts.
- Check the command-line PHP
Make sure the terminal and Apache use the intended PHP installation.
php -v
php -mVerify Composer autoloading#
<?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());MNB PHPExcel 2.0.5
Array
(
[php] => ...
[xlsx] => ...
)Use a predictable project 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.