Database Module
Use the independent format-neutral PDO module for validation, mapping, domain imports, SQL batches, manifests, failed rows, and database cursors.
Updated
SqlImporter::importRows()DomainImporter::create()DatabaseConnectionFactory::make()What you will learn
- Install database workflows without automatically installing XLSX.
- Import any iterable row source into PDO.
- Add the source format package or the database-XLSX bridge only when required.
Install the format-neutral PDO package#
composer require mnb/mnb-phpexcel:^2.0This package requires only Core and ext-pdo. It does not install XLSX or any other format reader.
Import rows from any source#
use Mnb\PHPExcel\Import\SqlImporter;
$result = (new SqlImporter())->importRows(
$pdo,
'customers',
$rows,
[
'batch_size' => 500,
'duplicate_strategy' => 'skip',
]
);$rows may be an array, generator, database cursor, CSV session, JSON session, XML session, native XLS session, native XLSX session, or another iterable normalized by your application.
Install source formats separately#
| Need | Install |
|---|---|
| CSV rows into PDO | mnb/mnb-phpexcel:^2.0 plus mnb/mnb-phpexcel:^2.0 |
| Native XLS rows into PDO | mnb/mnb-phpexcel:^2.0 plus Database |
| Normal XLSX rows into PDO | mnb/mnb-phpexcel:^2.0 plus Database |
| Very large XLSX direct streaming | mnb/mnb-phpexcel:^2.0 |
| Complete facade and every integration | mnb/mnb-phpexcel:^2.0 or mnb/mnb-phpexcel:^2.0 |
Was this guide useful?Use GitHub issues for corrections, missing examples, or unclear behavior.
Open an issue