Skip to content
MNB PHPExcelDeveloper Guide
AI

Imports

Domain Import APIs

Use typed presets for common business, education, CRM, ecommerce, and content imports.

Level
Intermediate
Reading time
13 min
Package
mnb/mnb-phpexcel
Updated
importProducts()importUsers()importOrders()importInventory()importDomain()

Domain imports add common aliases, canonical fields, normalization, validation, cross-field rules, duplicate keys, previews, templates, and progress on top of the generic SQL engine.

PresetConvenience methodTypical unique key
UsersimportUsers()email / username
ProductsimportProducts()sku
OrdersimportOrders()order number
InventoryimportInventory()sku + location
StudentsimportStudents()student id
AttendanceimportAttendance()person + date
MarksimportMarks()student + subject
ContactsimportContacts()email / phone
LocationsimportLocations()code / coordinates
Blog postsimportBlogPosts()slug
Media pathsimportMedia()path / URL
CategoriesimportCategories()slug / code

Complete example

Import products
$result = MnbExcel::importProducts(
    'products.xlsx',
    $pdo,
    'products',
    [
        'batch_size' => 1000,
        'duplicate_strategy' => 'update',
        'unique_by' => ['sku'],
        'failed_rows_csv' => __DIR__ . '/failed-products.csv',
    ]
);

Override the preset

Presets are defaults, not locked schemas. Override mappings, aliases, rules, defaults, normalizers, transformations, unique keys, duplicate behavior, sheet selection, progress, and failed-row paths per application.