Database + XLSX · Large files
Database + XLSX large files 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.
Database + XLSX individual library
Large files examples with copy-ready, production-minded PHP.
Every snippet uses mnb/mnb-phpexcel-database-xlsx 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
- 1
- documented methods
LargeExcelDatabaseImportEngine::importToSql()<?php
declare(strict_types=1);
/*
Summary:
Persist a manifest and resume from the last committed source row.
Implementation note:
Keep the source file unchanged while its manifest is active and use a database unique constraint
to make replay safe.
*/
use Mnb\PHPExcel\Large\LargeExcelDatabaseImportEngine;
$result = (new LargeExcelDatabaseImportEngine())->importToSql(
__DIR__ . '/orders.xlsx',
$pdo,
'orders',
[
'sheet' => 'Orders',
'chunk_size' => 2_000,
'batch_size' => 500,
'manifest_path' => __DIR__ . '/storage/orders-import.json',
'resume' => true,
'duplicate_strategy' => 'update',
'unique_by' => ['order_id'],
]
);LargeExcelDatabaseImportEngine::importToSql()<?php
declare(strict_types=1);
/*
Summary:
Write rejected source rows and validation errors to a durable CSV file.
Implementation note:
Store failure files outside the public web root and expose them through an authenticated
download workflow.
*/
use Mnb\PHPExcel\Large\LargeExcelDatabaseImportEngine;
$result = (new LargeExcelDatabaseImportEngine())->importToSql(
__DIR__ . '/products.xlsx',
$pdo,
'products',
[
'sheet' => 'Products',
'skip_invalid_rows' => true,
'failed_rows_csv' => __DIR__ . '/storage/products-failed.csv',
'rules' => [
'sku' => ['required'],
'price' => ['required', 'numeric', 'min:0'],
],
]
);No matching example found.Try a method name, task, or result.
Was this guide useful?Use GitHub issues for corrections, missing examples, or unclear behavior.
Open an issue