
- MODX 3
- PHP 8.1
- miniShop3


Component for quick generation of MiniShop3 demo data: vendors, categories, products, customers, and orders. Useful for testing the store, client demos, and development.
| Requirement | Version |
|---|---|
| MODX Revolution | 3.0.0+ |
| PHP | 8.1+ |
| MiniShop3 | 1.0.0+ |
| Package | Required | Purpose |
|---|---|---|
| MiniShop3 | Yes | Store data models |
| Scheduler | Optional | Async execution for large packages |
| VueTools | Yes | Vue 3 and PrimeVue for the UI |
| Library | Version | Purpose |
|---|---|---|
| fakerphp/faker | ^1.23 | Realistic data generation |
git clone https://github.com/biz87/ms3DemoData.git
cd ms3demodata
# PHP dependencies
cd core/components/ms3demodata
composer install
# Vue widgets
cd ../../../vueManager
npm install
npm run buildAfter installation the component is available in Extras → MS3 Demo Data.
The component interface lets you:
Three preset packages are available:
| Entity | Count |
|---|---|
| Vendors | 4 |
| Categories | 6 (2 root, depth up to 3) |
| Products | 100 |
| Customers | 20 |
| Orders | 50 (1–3 products, last 6 months) |
Good for quick testing and demos.
| Entity | Count |
|---|---|
| Vendors | 20 |
| Categories | 20 (7 root, depth up to 3) |
| Products | 2,000 |
| Customers | 200 |
| Orders | 500 (1–5 products, over a year) |
Good for testing filter and search performance.
| Entity | Count |
|---|---|
| Vendors | 100 |
| Categories | 100 (33 root, depth up to 4) |
| Products | 200,000 |
| Customers | 5,000 |
| Orders | 20,000 (1–10 products, over 2 years) |
For load testing. Using Scheduler is recommended.
Large package
Generating the large package (L) synchronously can take a long time and cause timeouts. Use Scheduler for background generation.
Generation runs immediately and the result is returned in the browser. Suitable for small and medium packages.
The job is queued in Scheduler and runs in the background. Required for large packages. Requires the Scheduler component to be installed.
core/components/ms3demodata/
├── src/
│ ├── MS3DemoData.php # Main facade
│ ├── Services/
│ │ └── DemoDataGenerator.php # Generation coordinator
│ └── Generators/ # Data generators
│ ├── AbstractGenerator.php # Base class
│ ├── VendorGenerator.php
│ ├── CategoryGenerator.php
│ ├── ProductGenerator.php
│ ├── CustomerGenerator.php
│ └── OrderGenerator.php
├── config/packages/ # Package configs
│ ├── small.php
│ ├── medium.php
│ └── large.php
├── elements/tasks/ # Scheduler tasks
└── lexicon/{ru,en}/ # Localization// Get service
$ms3demodata = $modx->services->get('ms3demodata');
// Create generator
$generator = new \MS3DemoData\Services\DemoDataGenerator($modx);
// Run generation
$result = $generator->run([
'package' => 'S', // S, M or L
'parent_id' => 0, // Parent resource ID
'category_template' => 1, # Category template ID
'product_template' => 2, # Product template ID
'source_id' => 1, # Media Source ID
'generate_customers' => true,
'generate_orders' => true,
]);
if ($result['success']) {
echo $result['message'];
// "Generation completed in 5.23 sec. Created: vendors — 4, categories — 6, products — 100, customers — 20, orders — 50"
}To add a new data type, create a class extending AbstractGenerator:
namespace MS3DemoData\Generators;
class MyCustomGenerator extends AbstractGenerator
{
protected function loadData(): void
{
$this->data = [
'items' => ['Item 1', 'Item 2', 'Item 3'],
];
}
public function generate(): array
{
$ids = [];
$count = $this->config['my_items']['count'] ?? 10;
for ($i = 0; $i < $count; $i++) {
$item = $this->modx->newObject('MyModel');
$item->set('name', $this->faker->sentence(3));
if ($item->save()) {
$ids[] = $item->get('id');
$this->created++;
} else {
$this->errors++;
}
}
return $ids;
}
}Package config files (config/packages/*.php) return an array of options:
return [
'code' => 'S',
'name' => 'Small',
'vendors' => [
'count' => 4,
],
'categories' => [
'count' => 6,
'root_count' => 2,
'max_depth' => 3,
],
'products' => [
'count' => 100,
],
'customers' => [
'count' => 20,
],
'orders' => [
'count' => 50,
'min_products' => 1,
'max_products' => 3,
'date_from' => '-6 months',
'date_to' => 'now',
],
];The component supports Russian and English. Lexicon files are in lexicon/{ru,en}/default.inc.php.