PHPackages                             supravatm/magento2-module-fake-data-api - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. supravatm/magento2-module-fake-data-api

ActiveMagento2-module[Testing &amp; Quality](/categories/testing)

supravatm/magento2-module-fake-data-api
=======================================

A lightweight and non-intrusive(no DB bloat unless you extend it to save) Magento 2 module to generate fake customers, products, and orders via GraphQL &amp; REST APIs.

v1.0.0(7mo ago)321MITPHPPHP ^7||^8

Since Sep 17Pushed 7mo agoCompare

[ Source](https://github.com/supravatm/magento2-fake-data-api)[ Packagist](https://packagist.org/packages/supravatm/magento2-module-fake-data-api)[ RSS](/packages/supravatm-magento2-module-fake-data-api/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (3)Versions (2)Used By (0)

🧪 Magento 2 Mock Data Generator (GraphQL + REST API)
====================================================

[](#-magento-2-mock-data-generator-graphql--rest-api)

A lightweight and non-intrusive(no DB bloat unless you extend it to save) **developer-friendly Magento 2 module** to generate **fake customers, products, and orders** via **GraphQL &amp; REST APIs**. Powered by [FakerPHP](https://fakerphp.org/).

Useful when:
✅ You need quick test data for local/staging development
✅ Testing GraphQL storefronts (Vue, React, PWA Studio, etc.)
✅ Avoiding manual CSV uploads or repetitive admin work

---

🚀 Features
----------

[](#-features)

- Generate **Customers, Products, and Orders** with one API call
- Supports **REST (`/V1/mockdata/generate`)** and **GraphQL**
- Customizable `entity` and `numberOfItems` parameters
- Lightweight and non-intrusive (no DB bloat unless you extend it to save)

---

📦 Installation
--------------

[](#-installation)

#### Install via Composer (recommended)

[](#install-via-composer-recommended)

If your module is published on Packagist, you can install it directly:

```
  composer require --dev supravatm/magento2-module-fake-data-api
  bin/magento module:enable SMG_MockDataGenerator
  bin/magento setup:upgrade
```

> Preferred way : easier upgrades, dependency management, Packagist support.

#### Manual Installation (alternative)

[](#manual-installation-alternative)

Download the module `.zip` or clone the repo. Extract it into Magento’s `app/code` directory:

```
mkdir -p app/code/SMG
cd app/code/SMG
git clone git@github.com:supravatm/magento2-fake-data-api.git MockDataGenerator
bin/magento module:enable SMG_MockDataGenerator
bin/magento setup:upgrade
bin/magento cache:flush
```

---

🔧 Usage
-------

[](#-usage)

### ✅ REST API

[](#-rest-api)

**Endpoint:**

```
POST /rest/V1/mockdata/generate

```

**Body Example:**

```
{
    "entity": "product",
    "numberOfItems": 1,
    "searchCriteria": {
        "pageSize": 10,
        "currentPage": 1
    }
}
```

**Response:**

```
{
    "items": [
        {
            "entity_id": 1,
            "sku": "FAKE-8051WX",
            "name": "Portable Smartphone",
            "attribute_set_id": 4,
            "price": 893.19,
            "status": 1,
            "visibility": 4,
            "type_id": "simple",
            "created_at": "2025-03-02 06:40:17",
            "updated_at": "2025-09-14 22:45:57",
            "weight": 1.92,
            "extension_attributes": {
                "website_ids": [
                    1
                ],
                "category_links": [
                    {
                        "position": 0,
                        "category_id": "3",
                        "extension_attributes": {}
                    }
                ],
                "stock_item": {
                    "item_id": 0,
                    "product_id": 0,
                    "stock_id": 1,
                    "qty": 32,
                    "is_in_stock": false,
                    "use_config_manage_stock": true,
                    "manage_stock": true,
                    "extension_attributes": {}
                }
            },
            "product_links": [],
            "options": [],
            "media_gallery_entries": [],
            "tier_prices": [],
            "custom_attributes": [
                {
                    "attribute_code": "description",
                    "value": "High-quality Portable Smartphone with long battery life."
                },
                {
                    "attribute_code": "short_description",
                    "value": "Stylish portable smartphone available in navy."
                },
                {
                    "attribute_code": "color",
                    "value": "navy"
                }
            ]
        }
    ],
    "search_criteria": {
        "filter_groups": [],
        "page_size": 1,
        "current_page": 1
    },
    "total_count": 1
}
```

---

### ✅ GraphQL

[](#-graphql)

**Query:**

```
{
  MockDataProduct(numberOfItems: 1) {
    items {
      entity_id
      name
      price
      sku
      status
      type_id
      visibility
      weight
    }
    total_count
  }
}
```

**Response:**

```
{
  "data": {
    "MockDataProduct": {
      "items": [
        {
          "entity_id": 1,
          "name": "Smart Backpack",
          "price": 531.97,
          "sku": "FAKE-0348VS",
          "status": 1,
          "type_id": "simple",
          "visibility": 4,
          "weight": 4.41
        }
      ],
      "total_count": 1
    }
  }
}
```

```
{
  MockDataCustomer(numberOfItems: 1) {
    items {
      addresses
      {
        street
        country_id
      }
      id
      email
    }
    total_count
  }
}
```

**Response:**

```
{
  "data": {
    "MockDataCustomer": {
      "items": [
        {
          "addresses": [
            {
              "street": [
                "23973 Maxime Grove"
              ],
              "country_id": "US"
            },
            {
              "street": [
                "9718 Jonathan Rapid Apt. 836"
              ],
              "country_id": "US"
            }
          ],
          "id": 540,
          "email": "hartmann.dexter@example.net"
        }
      ],
      "total_count": 1
    }
  }
}
```

```
{
  MockDataOrder(numberOfItems: 1) {
    items {

      billing_address {
        street
        city
        country_id
      }
      customer_email
      increment_id
      grand_total
      items {
        sku
        name
        qty_ordered
      }
      payment {
        method
        amount_paid
      }
      shipping_amount
      state
      status
      status_histories {
        comment
        status
      }
    }
    total_count
  }
}
```

**Response:**

```
{
  "data": {
    "MockDataOrder": {
      "items": [
        {
          "billing_address": {
            "street": [
              "4994 Jakubowski Bypass"
            ],
            "city": "Port Keatonville",
            "country_id": "SA"
          },
          "customer_email": "queen.osinski@example.net",
          "increment_id": "427471870",
          "grand_total": 1533.49,
          "items": [
            {
              "sku": "SKU-668UB",
              "name": "Ergonomic Laptop",
              "qty_ordered": 3
            }
          ],
          "payment": {
            "method": "paypal",
            "amount_paid": 1533.49
          },
          "shipping_amount": 13.93,
          "state": "closed",
          "status": "pending",
          "status_histories": [
            {
              "comment": "Package delayed due to carrier issues. Informed customer.",
              "status": "complete"
            }
          ]
        }
      ],
      "total_count": 1
    }
  }
}
```

---

⚙️ Supported Entities
---------------------

[](#️-supported-entities)

- `customer`
- `product`
- `order`

*(You can extend this to support categories, reviews, invoices, etc.)*

---

🧑‍💻 Development Notes
---------------------

[](#‍-development-notes)

- Uses [FakerPHP](https://fakerphp.org/) for data generation
- Data is **returned via API response** only (does not save to DB by default)
- You can extend `MockDataRepository.php` to insert generated entities into Magento DB

---

📝 License
---------

[](#-license)

This repository is licensed under the [MIT License](https://opensource.org/licenses/MIT). Feel free to fork, modify, and share.

---

© 2025 Supravat Mondal. All rights reserved.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance66

Regular maintenance activity

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

234d ago

### Community

Maintainers

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

---

Top Contributors

[![supravatm](https://avatars.githubusercontent.com/u/6244832?v=4)](https://github.com/supravatm "supravatm (9 commits)")

---

Tags

data-fakerfake-datafakerfakerphpmagento2sample-datatest-data-generatortestinggraphqlordersproductsmagento2customersdev-toolstest dataFake dataSample Datamock datadata-fakerdevelopment-only

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/supravatm-magento2-module-fake-data-api/health.svg)

```
[![Health](https://phpackages.com/badges/supravatm-magento2-module-fake-data-api/health.svg)](https://phpackages.com/packages/supravatm-magento2-module-fake-data-api)
```

###  Alternatives

[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.0k](/packages/orchestra-testbench)[orchestra/workbench

Workbench Companion for Laravel Packages Development

8017.0M43](/packages/orchestra-workbench)[icomefromthenet/reverse-regex

Convert Regular Expressions into text, for testing

136386.7k12](/packages/icomefromthenet-reverse-regex)[marvinrabe/laravel-graphql-test

Provides you with a simple GraphQL testing trait.

58329.7k](/packages/marvinrabe-laravel-graphql-test)

PHPackages © 2026

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