# bigbridge/product-import

> Fast product import library for Magento 2

`composer require bigbridge/product-import`

Canonical URL: https://packagento.com/bigbridge/product-import

## At a glance

- **Vendor**: bigbridge (https://packagento.com/bigbridge.md)
- **Latest version**: 1.8.0 — released 2025-11-21
- **Pricing**: Free
- **Package type**: Magento 2 module
- **Status**: active, accepting new buyers

## Installation

Packagento is licence-gated, so even free packages need a licence on a project before Composer can resolve them.

1. **Sign in or create an account** at https://packagento.com/customer/account/.

2. **Add the package to your account.** Open https://packagento.com/bigbridge/product-import and complete the free checkout. A licence is minted automatically.

3. **Create or pick a project, then activate the licence on it.**
   - Projects represent the Magento installs you deploy to. Manage them at https://packagento.com/projects/.
   - Activate the new licence on the project you'll deploy this package to. Activation is what generates the Composer credentials scoped to that project.

4. **Add the project credentials to your Magento codebase.**

   Grab the project's public + private key from https://packagento.com/projects/ (open the project, then its Credentials tab), and add them to `auth.json`:

   ```json
   {
     "http-basic": {
       "packagento.com": {
         "username": "ppk_live_...",
         "password": "psk_live_..."
       }
     }
   }
   ```

   Add the Packagento Composer repository to `composer.json`:

   ```json
   {
     "repositories": [
       { "type": "composer", "url": "https://packagento.com" }
     ]
   }
   ```

5. **Install and apply.**

   ```bash
   composer require bigbridge/product-import:*
   bin/magento setup:upgrade
   bin/magento setup:di:compile
   bin/magento cache:flush
   ```

## What it does

Fast product import library for Magento 2

## README

Hi! My name is Patrick van Bergen. I created this library because I needed product import to be fast.

This library imports product data into Magento 2 via direct database queries. It has these main features

* A programming library to import products
* An CLI command for product import via XML file
* A web API service for product import via Post Request with XML
* A tool to update url_rewrites

### Note

The aim of this library is speed. If you find that Magento 2's product importer is too slow, consider using this library.

Experiment with the library in a safe webshop. Make sure to create a database backup before you start.

### Sample code

Let me show you a piece of code to give you an impression what it is like to use this library:

        $importer = $factory->createImporter($config);

        foreach ($lines as $i => $line) {

            $product = new SimpleProduct($line[1]);

            // global eav attributes
            $global = $product->global();
            $global->setName($line[0]);
            $global->setPrice($line[2]);

            // German eav attributes
            $german = $product->storeView('de_store');
            $german->setName($line[3]);
            $german->setPrice($line[4]);

            $importer->importSimpleProduct($product);
        }

        // process any remaining products in the pipeline
        $importer->flush();

 
Continue to read [the full documentation](doc/importer.md)

### Installation

    composer require bigbridge/product-import

### Requirements

* For Magento 2.1+ Opensource Edition
* Requires >= PHP 7.0
* Input in UTF-8 (Magento standard)
* Unix family system

### Features of the Import Library

* insert, update and delete products
* product identification based on product sku or id
* all product types (simple, configurable, grouped, bundle, downloadable, and virtual)
* automatic category generation
* automatic select and multiselect attribute option creation
* import of images from file or url
* image caching (local and HTTP cache)
* custom options
* unique url_key generation
* url_rewrite creation
* whitespace trimming (spaces, tabs, newlines) from all fields, except free field texts
* attribute deletion
* input validation (data type, requiredness,  and length restrictions)
* product type changes
* importing links to products have not been imported yet
* dry run (no products are written to the database)
* multi-source inventory (msi)
* weee taxes
* removes the url_path attribute of imported products
* M2EPro notification

Continue to read about [all importer features](doc/importer.md)

### XML file import tool

The XML import tool allows you to import product data with an XML file. It is fast and has a fixed, low memory footprint.

~~~
    bin/magento bigbridge:product:import
~~~

Continue to read about  [XML file import](doc/xml-file-import.md)

### Web API import service

The web api service performs the same service as the file import tool. But it is accessible via an XML REST call.

    /rest/V1/bigbridge/products

It is a POST call and the XML is passed in the request body.

Continue to read about [XML webapi import](doc/xml-webapi-import.md)

### The url_rewrite tool

Since Magento's url_rewrite table can get corrupted in many ways, it is necessary to have a tool to fix it.

This tool has the following features:

* Fast, it writes queries directly.
* It imposes no downtime for the webshop
* It updates the url_rewrite and catalog_url_rewrite_product_category per product
* It respects Magento's configuration setting "Create Permanent Redirect for URLs if URL Key Changed"
* It does not delete existing 301 url_rewrite redirects
* It does not overwrite existing non-product rewrites
* Updating single store views is possible
* Products with a visibility of "not-visible-individually" get no url_rewrite (since they would have no use; this is Magento 2 policy)

~~~
    bin/magento bigbridge:product:urlrewrite
~~~

Continue to read about [the Url Rewrite Tool](doc/url-rewrite-tool.md)

### Changes to Magento

The extension adds an index CATALOG_PRODUCT_ENTITY_VARCHAR_ATTRIBUTE_ID_VALUE to catalog_product_entity_varchar because it drastically speeds up checking for duplicate url_keys.

### Thanks to

Thanks to Marco de Vries for telling me about the intricacies of product import.

Thanks to Martijn van Berkel for first volunteering to use the importer in production environments and for providing valuable feedback.

This project owes a great deal of ideas and inspiration from Magmi / Magento 1 [Magmi](https://github.com/dweeves/magmi-git)

## Changelog

## 1.7.4 : Simplify access to core config data 

Pull request by Pieter Hoste, rewrites code that was optimized without need and which also lacked features. 

## 1.7.3 : Reopen a closed MySQL connection

Pull request by Pieter Hoste, reopens a MySQL connection that was closed due to inactivity.

## 1.7.2 : Use official Magento version detection when magento/magento2-base is not available

As mentioned by Pieter Hoste, magento/magento2-base may not be available; in this case the official version detection will now be used.

## 1.7.1 : More robust when handling non-existing categories.

Stronger getCategoryInfo check when fetching parent categories. Pull request by Duckↄhip.

## 1.7.0 : Support for M2EPro

An option to notify the extension M2EPro of changes to products.

## 1.6.2 : Remove cached images

In image-set-mode cached images were not removed when a new image was uploaded with the same name. They are now.

## 1.6.1 : Fix remove temporary images in force-download mode

In the (default) mode where images are re-downloaded each import, the images were left in the temporary directory (even though they were not used again). This is now no longer the case. The images are removed after the import.  

### 1.6.0 : Flat type category url paths

* An option, requested by Chris Astley, to create simple url_path attributes for generated categories (i.e 'corner-chairs' instead of the standard 'furniture/tables/corner-chairs'). This extends to the url_rewrite entry as well. 

### 1.5.4 : Fix url rewrites problem

* The attribute `url_path`, if exists, is removed from the imported products
* Writes non-redirects (redirect_type = 0) before redirects (redirect_type = 301) in url_rewrite, because Magento relies on this order when it creates canonical urls and such.

### 1.5.3 : Added missing options

Added some options that were missing from the cli command and the rest api.

### 1.5.2 : Support for Magento 2.4

Support for 20.6 price decimal format.

Fixed import of tier prices in M2.4

### 1.5.1 : Fix XSD for multiple store views

The XSD that validates the product import XML did not allow multiple store views. 

### 1.5.0 : An option to have old category links removed

Guus Portegies asked for this option to have product-to-category links to be removed as well as added.

Setting `$config->categoryStrategy = ImportConfig::CATEGORY_STRATEGY_SET` will remove product-to-category links that are not named in the import.

Use responsively; the documentation explains when this is not a good idea. 

### 1.4.6 : url suffix per website

Take into account that product and category url suffix may differ per website.

### 1.4.5 : url suffix per store view

Take into account that product and category url suffix may differ per store view.

### 1.4.4 : Support for two added columns since M2.2 

lucafuse94 noticed that parent_product_id was missing from catalog_product_bundle_option_value. 

Started monitoring database changes between Magento versions, using Compalex. Added support for 

* Tier prices, percentage_value (since M2.2)
* Bundled product option value, parent_product_id (since M2.2)

Magento 2.3 only added MSI, and did not change the existing product tables.

### 1.4.3 : Sku case sensitive

SKU's are explicitly made case sensitive
Added a function to look up the case sensitive sku in the database.

### 1.4.2 : Fix category level

choleaoum noticed that the level field of created categories was one too high.
Also some missing trim()'s were added to clean input.  

### 1.4.1 : Fix category url_rewrite

The category entries for generated categories had 0 as store_id. Changed this to the ids of actual stores views.

### 1.4.0 : Weee tax

Pull request by Jessica Garcia Santana

- Support for import of a single custom weee attribute (Waste Electrical and Electronic Equipment taxes)

### 1.3.2 : Validation for compound members / default url suffix - 01-11-2019

_(Changelog truncated for .md surface. Full history on https://packagento.com/bigbridge/product-import.)_

## Recent Versions

| Version | Released |
|---|---|
| 1.8.0 | 2025-11-21 |
| 1.7.8 | 2025-11-21 |
| 1.7.7 | 2025-11-13 |
| 1.7.6 | 2022-06-03 |
| 1.7.5 | 2022-02-22 |
| 1.7.4 | 2021-09-01 |
| 1.7.3 | 2021-08-28 |
| 1.7.2 | 2021-06-21 |
| 1.7.1 | 2021-04-17 |
| 1.7.0 | 2021-03-15 |

Showing 10 of 38 versions. Full release history on https://packagento.com/bigbridge/product-import.

## Dependencies

### Require

| Package | Constraint |
|---|---|
| php | ^8.1 |

## Quality

Latest release (1.8.0) fails the Packagento QA pipeline. Verdicts below are per-cell (Magento line × PHP version) for the matrixed tools, and run-once for the static / security tiers.


### Compatibility

Each Magento line is installed on its supported PHP versions, then the module is built (DI compile + static-content deploy). Cells show passed / failed / untested; staircase gaps render as `–`.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | Pass | Pass | – | – |
| 2.4.8 | – | Pass | Pass | – |
| 2.4.9 | – | – | 1 | 1 |


### Code Quality

Advisory checks against the module's source. Never affect the Compatibility verdict — a phpcs finding can't make a module incompatible.

#### Static Analysis

Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| PHPCS | Fail | 1299 | 110 errors, 1189 warnings (ruleset: Magento2) — 456 auto-fixable with phpcbf |
| PHPMD | Warning | 118 | 118 rule violations (ExcessiveMethodLength:19, CyclomaticComplexity:16, ErrorControlOperator:16, UnusedLocalVariable:14, IfStatementAssignment:11) |
| Cpd | Warning | 1 | 1 duplicated chunk spanning 12 total lines (min-lines=5, min-tokens=70) |
| Composer validate | Pass | 0 |  |

#### PHPStan

Type-checks the module against a real Magento install. Re-runs per Magento + PHP version because resolvable symbols differ between releases.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | 57 | 57 | – | – |
| 2.4.8 | – | 57 | 57 | – |
| 2.4.9 | – | – | 59 | 59 |


### Tests

Unit and integration suites run per Magento + PHP cell. Test failures speak to the module's behaviour, not its compatibility with a line, so they're reported here separately.

#### Unit Tests

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | – | – |
| 2.4.8 | – | N/A | N/A | – |
| 2.4.9 | – | – | N/A | N/A |

#### Integration Tests

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | 4 | 4 | – | – |
| 2.4.8 | – | not tested | not tested | – |
| 2.4.9 | – | – | Error | Error |


### Security

Dependency-advisory audit (composer audit) plus a source malware scan. A malware detection fails the version outright.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| Composer audit | Pass | 0 |  |
| Malware scan | Pass | 0 |  |

## Licence and pricing

Free. A licence is still minted on checkout and bound to your project for Composer access — no payment step.

Refundable within 14 days of first purchase via https://packagento.com/account/refunds/.

## Install via Claude Code or any MCP client

The Packagento MCP server can run the licence + project + Composer steps above in one tool call:

```
purchase_and_install_packages(
  composer_names=["bigbridge/product-import"],
  project_id="proj_xxx"
)
```

This handles cart, checkout, licence minting, project activation, and writes auth.json credentials. Connect a client with `claude mcp add packagento https://mcp.packagento.com`. Full setup at https://packagento.com/docs/mcp-setup.

## Vendor

bigbridge is a Magento 2 vendor on Packagento. See https://packagento.com/bigbridge.md for their full catalogue.

