Standalone Database package
PHP Database Import Library for PDO Mapping & Validation
Use the standalone MNB PHPExcel Database package when your application already has iterable rows and needs format-neutral PDO imports with mapping, validation, batching, duplicate handling, domain presets, manifests, or failed-row reporting.
Composer
composer require mnb/mnb-phpexcel-database:^2.0- Package
mnb/mnb-phpexcel-database- Entry API
Mnb\PHPExcel\Import\SqlImporter- Runtime
- PHP 8.1+
- Format
- Iterable rows → PDO
Choose your Database workflow#
01
Connect PDO and import iterable rowsCreate database connections, batch inserts or updates, choose duplicate behavior, and import arrays, generators, cursors, or format sessions.
Connection & import →02Map and validate source recordsPreview headers, map source keys to database columns, normalize values, validate rows, and retain original source row numbers.
Mapping & validation →03Use domain import presetsStart from users, products, orders, inventory, students, contacts, locations, and other application-oriented import profiles.
Domain imports →04Operate large or resumable importsUse batches, manifests, progress, failed-row output, transaction boundaries, and replay-safe duplicate strategies.
Large & resumable →Use the right Database API#
| Task | Primary API | Choose it when |
|---|---|---|
| Import iterable rows into PDO | SqlImporter::importRows() | You already have normalized rows and need mapping, validation, batching, inserts/updates, and duplicate handling. |
| Run a domain-oriented import | DomainImporter::create() | Application presets, aliases, validation rules, previews, templates, or domain-specific defaults should sit above the generic SQL engine. |
| Build a PDO connection | DatabaseConnectionFactory::make() | Configuration values need to become a consistent PDO connection with package-level defaults. |
| Stream very large XLSX directly to PDO | LargeExcelDatabaseImportEngine | Use the separate mnb/mnb-phpexcel-database-xlsx bridge when XLSX chunk orchestration itself belongs to the job. |
What the standalone Database package covers#
Format-neutral PDO writes
- Arrays, generators, cursors, and normalized format sessions
- Batched inserts and update strategies
- Prepared statements and transaction controls
- Duplicate skip/update behavior with unique keys
Mapping and validation
- Explicit source-to-column maps and aliases
- Normalization, defaults and validation rules
- Preview/dry-run workflows before writes
- Original source-row tracking and failed-row reports
Production import workflows
- Domain presets and reusable application profiles
- Progress callbacks, manifests and resume state
- Batch sizing and replay-safe strategies
- No spreadsheet-format dependency unless you add one
Package boundary: mnb/mnb-phpexcel-database owns format-neutral PDO workflows. Add CSV, XLS, XLSX, JSON, XML, or ODS separately only when this package must open that source format. Use the monolithic package instead when one application intentionally owns the complete toolkit.
Was this guide useful?Use GitHub issues for corrections, missing examples, or unclear behavior.
Open an issue