MNB PHPExcelDeveloper Guide

Database · Imports

Database imports 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-database:^2.0Reference3 examples · 3 methods
Database individual library

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

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

3
examples
3
documented methods
Example 01

Insert iterable rows in PDO batches

Open related guide
SqlImporter::importRows()
insert-iterable-rows-in-pdo-batches.php
<?php

declare(strict_types=1);

/*
Summary:
    Import associative rows from any installed reader or application source into a database table.

Implementation note:
    The Database library accepts rows; it does not install a source format reader. Add CSV, XLS,
    XLSX, JSON, XML, or ODS only when needed.
*/

use Mnb\PHPExcel\Import\SqlImporter;

$result = (new SqlImporter())->importRows(
    $pdo,
    'products',
    $rows,
    [
        'batch_size' => 500,
        'duplicate_strategy' => 'update',
        'unique_by' => ['sku'],
        'skip_invalid_rows' => true,
    ]
);