PHPackages                             lsv/magento2-magmi-dump - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. lsv/magento2-magmi-dump

ActiveLibrary

lsv/magento2-magmi-dump
=======================

Magmi datapump API for Magento 2

v3.0.1(6y ago)31691[1 issues](https://github.com/lsv/magento2-magmi-datapump/issues)MITPHPPHP ^7.1

Since Sep 12Pushed 6y ago3 watchersCompare

[ Source](https://github.com/lsv/magento2-magmi-datapump)[ Packagist](https://packagist.org/packages/lsv/magento2-magmi-dump)[ RSS](/packages/lsv-magento2-magmi-dump/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (2)Dependencies (7)Versions (23)Used By (0)

Magento 2 - Magmi data dump
===========================

[](#magento-2---magmi-data-dump)

Using object oriented methods to use with [Magmi](https://github.com/macopedia/magmi-m2) for [Magento 2](https://magento.com/)

### Install

[](#install)

`composer require lsv/magento2-magmi-dump`

### Usage

[](#usage)

You can see a working magento2 module [here](https://github.com/lsv/magento2-magmi-datapump-magento-module).

```
use Lsv\Datapump\Configuration;
use Lsv\Datapump\ItemHolder;
use Lsv\Datapump\Logger;
use Lsv\Datapump\Product\ConfigurableProduct;use Monolog\Handler\StreamHandler;
use Lsv\Datapump\Product\SimpleProduct;use Symfony\Component\Console\Output\NullOutput;

// First we need to create a logger, due to Magmi is using a non standardized method, we need to make a little of a work around
$stream = __DIR__ . '/logfile.log';
$monologHandler = new StreamHandler($stream);
$monolog = new Monolog\Logger('default', [$monologHandler]);
$logger = new Logger($monolog);

// Next we need a configuration
$configuration = new Configuration(
    'path/to/magento/root', // Path to the root of your magento installation
    'databse name', // The name of the database
    'database host', // The host of the database
    'database username', // The username to the database
    'database password' // The password to the database
);

// Now we need a instance of Magmi

// Now we can create our ItemHolder which will hold the product we gonna import
$magmi = \Magmi_DataPumpFactory::getDataPumpInstance('productimport');

// If you want to have progressbar on the import, you can change $output to your OutputInterface
$output = new NullOutput();

// As magmi have troubles doing indexing on the fly, I have opted to turn it off, you can turn it with a true
$useMagmiIndexer = false;

$holder = new ItemHolder($configuration, $logger, $magmi, $output, $useMagmiIndexer);

// Now we can start by adding products to the item holder
$simpleProduct = (new SimpleProduct())
    ->setName('Simple product')
    ->setSku('sku')
    ->setDescription('Product description')
    ->setPrice(15.99)
    ->setTaxClass('tax name')
    ->setQuantity(10);

// This is the minimum data required for a simple product
// We can ofcourse add other attributes to the product
// But first you will need to manually add the attribute to the attribute set in magento backend, before it can be used

$simpleProduct->set('name_of_your_attribute', 'the_value');

// Now we have our simple product, we can now add it to our ItemHolder

$holder->addProduct($simpleProduct);

// And we can now import it
$holder->import();

// We have the option to create a "dry-run" which will not write to the database, but it will send the data to the console
// $holder->import(true)

// Configurable product

// A configurable product must have a list of attributes to create the configurable product from the simple products
// Here we use both color and size as attributes we will create the configurable product out of

$configurable = new ConfigurableProduct(['color', 'size']);
// A configurable product also need some magento data
$configurable
    ->setName('Configurable product')
    ->setSku('configurable-product')
    ->setDescription('description')
    ->setQuantity(0, true); // With 0 and true, we will set the configurable product to always be in stock

// The configurable product price will automatically be generated out of the prices on the simple products

// Now we need to add simple products to our configurable product
$simple1 = new SimpleProduct();
$simple1->setName('simple1');
$simple1->setSku('simple1');
$simple1->setDescription('description');
$simple1->setPrice(14.99);
$simple1->setTaxClass('tax name');
$simple1->set('color', 'blue');
$simple1->set('size', 'L');
// We need to set color and size on the simple product, because it is required by the configurable product
$configurable->addProduct($simple1);

// And add another simple product to our configurable
$simple2 = new SimpleProduct();
$simple2->setName('simple2');
$simple2->setSku('simple2');
$simple2->setDescription('description');
$simple2->setPrice(13.99);
$simple2->setTaxClass('tax name');
$simple2->set('color', 'green');
$simple2->set('size', 'M');
$configurable->addProduct($simple2);

// If you already have created the simple products, you can also add them to the configurable product by using
$configurable->addSimpleSku('already-created-sku-1');
$configurable->addSimpleSku('already-created-sku-2');

// And lets add our configurable product to our itemHolder
$holder->addProduct($configurable);
// Only the configurable product should be added to the itemHolder as the simple products will automatically be imported and checked for missing attributes
```

- [How to add categories to a product](documentation/categories.md)
- [How to add images to a product](documentation/images.md)
- [More about the itemHolder](documentation/itemholder.md)
- [Product relations, crosssell and upsell ](documentation/relations.md)
- [Delete product](documentation/deleteproduct.md)
- [Downloadable product](documentation/downloadableproduct.md)
- [Tier pricing](documentation/tierpricing.md)
- [Update product](documentation/updateproduct.md)

### TODO

[](#todo)

- Grouped products
- Bundle products
- Warehouse inventory
- Use Magento to copy media files, so its not hardcoded to media folder, and maybe can use correct storage
- Add video to product
- Delete products
- Other things?

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~11 days

Recently: every ~40 days

Total

20

Last Release

2222d ago

Major Versions

v1.0.3 → v2.02019-09-16

v2.0.11 → v3.02019-11-25

### Community

Maintainers

![](https://www.gravatar.com/avatar/ff9304e6a7caa208d631a1529240a97dff2f47dadde7bff153e8a90818047168?d=identicon)[lsv](/maintainers/lsv)

---

Top Contributors

[![lsv](https://avatars.githubusercontent.com/u/20708?v=4)](https://github.com/lsv "lsv (50 commits)")

---

Tags

magento2magmiproduct-importer

### Embed Badge

![Health badge](/badges/lsv-magento2-magmi-dump/health.svg)

```
[![Health](https://phpackages.com/badges/lsv-magento2-magmi-dump/health.svg)](https://phpackages.com/packages/lsv-magento2-magmi-dump)
```

###  Alternatives

[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M647](/packages/sylius-sylius)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[silverstripe/framework

The SilverStripe framework

7213.5M2.5k](/packages/silverstripe-framework)[contao/core-bundle

Contao Open Source CMS

1231.6M2.3k](/packages/contao-core-bundle)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
