designcoil/module-import-command
Composer 安装命令:
composer require designcoil/module-import-command
包简介
CLI commands (product:import:validate, product:import:run) wrapping Magento's native ImportExport pipeline
README 文档
README
CLI commands that wrap Magento's native ImportExport pipeline - the exact same codepath used by Admin > System > Data Transfer > Import.
Useful for large catalog imports without Admin timeouts. Importing 10k–100k+ products through the Admin UI often results in PHP max execution time exceeded, browser session expiration, Cloudflare timeouts. Running imports via CLI avoids web server limits and is suitable for large catalogs and scheduled batch jobs.
Commands
| Command | Description |
|---|---|
product:import:validate |
Validate a CSV import file and report errors |
product:import:run |
Validate, import, and invalidate indexes |
Requirements
- Magento 2.4.x (Open Source or Commerce)
- PHP 8.2, 8.3, or 8.4
Installation
Via Composer (recommended)
composer require designcoil/module-import-command bin/magento module:enable DesignCoil_ImportCommand bin/magento setup:upgrade bin/magento setup:di:compile
Manual
Copy the module to app/code/DesignCoil/ImportCommand/, then:
bin/magento module:enable DesignCoil_ImportCommand bin/magento setup:upgrade bin/magento setup:di:compile
Usage
Validate a CSV file
bin/magento product:import:validate \ --entity=catalog_product \ --file=var/import/products.csv
Output on success:
Validation result: OK
Summary:
Rows processed: 100
Entities processed: 100
Invalid rows: 0
Total errors: 0
Error limit exceeded: No
Output on failure:
Validation result: FAILED
Errors:
Wrong URL/path used for attribute additional_images in row(s): 1, 2
Summary:
Rows processed: 100
Entities processed: 100
Invalid rows: 2
Total errors: 2
Error limit exceeded: No
Run a full import
bin/magento product:import:run \ --entity=catalog_product \ --file=var/import/products.csv \ --behavior=append \ --images-file-dir=var/import/images
Output:
Validating import data...
Validation passed. Importing 100 row(s) in 1 batch(es)...
1/1 batches [============================] 100%
Import completed successfully.
Created: 80
Updated: 20
Deleted: 0
Summary:
Rows processed: 100
Entities processed: 100
Invalid rows: 0
Total errors: 0
Error limit exceeded: No
CLI Options
All options are available on both commands.
Required
| Option | Description |
|---|---|
--entity |
Entity type code: catalog_product, customer, customer_address, etc. |
--file |
Path to CSV file. Absolute or relative to Magento root. |
Import behavior
| Option | Default | Description |
|---|---|---|
--behavior |
append |
Import behavior: append, add_update, replace, delete |
Validation
| Option | Default | Description |
|---|---|---|
--validation-strategy |
validation-stop-on-errors |
validation-stop-on-errors or validation-skip-errors |
--allowed-error-count |
10 |
Maximum number of errors before stopping |
CSV format
| Option | Default | Description |
|---|---|---|
--field-separator |
, |
Column delimiter |
--multiple-value-separator |
, |
Separator for multi-value fields |
--enclosure |
" |
CSV field enclosure character |
--fields-enclosure |
off | Flag. Enables fields enclosed by double-quotes (matches Admin checkbox) |
File & locale
| Option | Default | Description |
|---|---|---|
--images-file-dir |
(none) | Images directory relative to Magento root (e.g. var/import/images) |
--locale |
(none) | Locale code for import (e.g. en_US) |
How it works
- The CSV file is copied into
var/importexport/- the same temp location Magento's admin upload uses. - A native
Magento\ImportExport\Model\Import\Source\Csvadapter is created. Import::validateSource()validates the data and saves it to the database in batches.Import::importSource()reads those batches and performs the actual create/update/delete operations.Import::invalidateIndex()marks related indexers for reindex.
This is identical to clicking Check Data and then Import in the admin panel.
Examples
Product import with semicolon-delimited CSV:
bin/magento product:import:run \ --entity=catalog_product \ --file=/absolute/path/to/products.csv \ --behavior=append \ --field-separator=";" \ --multiple-value-separator="|" \ --images-file-dir=var/import/images \ --fields-enclosure
Customer import, skip errors:
bin/magento product:import:run \ --entity=customer \ --file=var/import/customers.csv \ --behavior=add_update \ --validation-strategy=validation-skip-errors \ --allowed-error-count=50
Validate only (dry run):
bin/magento product:import:validate \ --entity=catalog_product \ --file=var/import/products.csv \ --validation-strategy=validation-skip-errors \ --allowed-error-count=100 \ --images-file-dir=var/import/images
License
designcoil/module-import-command 适用场景与选型建议
designcoil/module-import-command 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3 次下载、GitHub Stars 达 1, 最近一次更新时间为 2026 年 02 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「csv」 「catalog」 「cli」 「import」 「magento2」 「product-import」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 designcoil/module-import-command 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 designcoil/module-import-command 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 designcoil/module-import-command 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
laravel facade to read/write csv file
Collection of tools to use the full power of the Enyalius framework
Slim starter / Slim skeleton package to boost your development with Slim framework
Extension for Catalog Manager.
Generates a trait to help ease the access of custom repo methods
Advanced ratings plugin for Premium Contao Themes CustomCatalog module https://www.premium-contao-themes.com/
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 36
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-02-12