Releases: run-as-root/magento-2-seeder
Release list
v1.4.0 — Commerce Faker Provider
What's new
$faker->productName(), ->productAdjective(), ->productMaterial(), ->product(), ->productDepartment() — FakerJS's commerce module, ported to PHP and registered on every Faker generator this module hands out.
Seeded product names now read Fresh Bronze Chair / Sleek Gold Tuna / Handcrafted Rubber Pizza instead of Dolor Sit Amet. Category names come from the curated upstream department list (Books, Automotive, Jewelery, …) instead of a hardcoded 20-entry list with a lorem suffix.
Installation
composer require runasroot/module-seeder:^1.4
bin/magento setup:upgradeFully backward compatible with 1.3.x. No new composer requires. FakerFactory::__construct() gained an optional argument; existing callers work unchanged.
Scope
en_USwordlists only in v1 — other locales silently fall back to English.- Wordlists ported verbatim from @faker-js/faker (MIT) at commit
9e2c0e391b436f56ff54ad89d02efa9982406389. Attribution inNOTICE; refresh guide insrc/Faker/Provider/Data/Commerce/README.md.
See CHANGELOG.md for the full entry.
v1.3.0 — Interactive CLI
Highlights
- New
bin/magento db:seed:makecommand — interactive scaffolder for seeder files. Eliminates the empty-dev/seeders/dead-end for new users. - Multi-select entity types in the interactive flow with cascade hints (e.g.
order — cascades: customer, product, category). - Progress rendering for count-based file seeders — no more silent hangs on
db:seedwith large counts. - Spinner for custom
SeederInterfaceimplementations, TTY-gated so CI stays clean.
See CHANGELOG.md for the full list.
Install
composer require runasroot/module-seeder:^1.3
bin/magento setup:upgradeFully backward compatible with 1.2.x.
v1.2.1
Fixed
db:seed --freshno longer crashes with "Delete operation is forbidden for current area" on installs that carry sample data (or any non-seeder products/categories).SeedCommandnow registersisSecureArea = truealongside the existingadminhtmlarea code, so category/product cleanup can pass Magento's delete guards from CLI. Registration is skipped when the flag is already set by an outer caller to avoid clobbering.
v1.2.0 — Cart Rules, Wishlists, Newsletter Subscribers
Added
- Three new entity types:
cart_rule,wishlist,newsletter_subscriber— each with aDataGenerator+EntityHandlerpair. Reachable via--generate=cart_rule:N,--generate=wishlist:N,--generate=newsletter_subscriber:N, or the fluentseed('<type>')builder entry. CartRuleDataGenerator— weighted action mix ofby_percent(60%) /by_fixed(30%) /free_shipping(10%). Each rule gets one attached manual coupon with code format<PREFIX><amount>-<6 uppercase alnum>, active for all websites + all four default customer groups, expires in 1 year, applies to all carts.WishlistDataGenerator— one wishlist per seeded customer with 1–5 random products. Declarescustomer:Nas dependency so--generate=wishlist:50auto-seeds 50 customers.NewsletterSubscriberDataGenerator— 50/50 mix of customer-linked subscribers and guest emails. Dedup of linked customers derived from registry state so no leak between runs.CustomerDataGeneratornow emits 1–3 addresses per customer (first remains default billing/shipping).- Integration smoke test covering all three new types + 23 new handler unit tests (289 total).
Changed
EntityHandlerPool/DataGeneratorPoolitems now wire through\Proxysobin/magento setup:installdoesn't eagerly instantiate EAV-touching handlers before the schema exists.
Fixed
ProductHandlerresolves the image import dir viaDirectoryList::getPath(DirectoryList::MEDIA)instead ofgetRoot() . '/pub/media/...'— sandboxed installs that remap MEDIA no longer fail PathValidator.
Installation
```bash
composer require runasroot/module-seeder:^1.2
bin/magento setup:upgrade
```
Fully backward compatible with 1.1.x — no public API changes.
Full changelog: https://github.com/run-as-root/magento-2-seeder/blob/main/CHANGELOG.md
v1.1.0 — Seeder facade
Added
- Abstract
RunAsRoot\Seeder\Seederbase class so class-based seeders skip theEntityHandlerPoolboilerplate and extend a typed fluent base. - Fluent
RunAsRoot\Seeder\SeedBuilderAPI:$this->orders()->count(50)->with([...])->using($fn)->subtype('bundle')->create(). Per-iteration callbacks receive(int $i, Faker\Generator $faker). examples/FluentOrderSeeder.phpdemonstrating the new style.
Changed
SeedBuilder::create()writes created entity data (including theidreturned by the handler) intoGeneratedDataRegistryunder the base type, matchingGenerateRunnersemantics. This means later builders within the samerun()can reference ids through generators.
Installation
composer require runasroot/module-seeder:^1.1
bin/magento setup:upgradeFully backward compatible with 1.0.x — existing implements SeederInterface seeders keep working.
Full changelog: https://github.com/run-as-root/magento-2-seeder/blob/main/CHANGELOG.md
v1.0.0 — First stable release
First stable release of runasroot/module-seeder. Laravel-style database seeding for Magento 2 via bin/magento db:seed.
composer require runasroot/module-seeder:^1.0 --dev
bin/magento module:enable RunAsRoot_Seeder
bin/magento setup:upgrade
bin/magento setup:di:compileHighlights
- 5 entity handlers:
category,product,customer,order,cms - 5 product type builders:
simple,configurable(3×2 variants),bundle,grouped,downloadable - 6 order state transitions:
new,holded,canceled,processing(invoice),complete(invoice + ship),closed(invoice + refund) - Automatic product reviews: Faker-generated reviews + rating votes attached as Approved so they render on the frontend
- Smart dependency resolver:
--generate=order:1000auto-pulls customers/products/categories at sensible ratios - Even category distribution via least-used-first algorithm — seeded products actually land in seeded categories
db:seed:statuscommand prints DB counts of all seeded entity types--fresh,--locale,--seed,--stop-on-error,--only,--excludeflags
Quick taste
# 5 categories, mixed product types, 100 orders with reviews
bin/magento db:seed --generate=category:5,product.simple:30,product.configurable:5,product.bundle:3,product.grouped:3,product.downloadable:3,order:100Breaking changes
EntityHandlerInterface::create(array $data): void→: int— custom handlers in consumer projects must return the saved entity primary key. PHP will surface this at class-load with a clear "declaration must be compatible" error.
Full changelog
See CHANGELOG.md for the detailed breakdown of every Added / Changed / Fixed entry including the trail of bug fixes landed during development (customer phone regex, quote store context, invoice-driven state persistence, and the registry id propagation that made seeded categories actually hold products).
Compatibility
- PHP 8.1, 8.2, 8.3 (CI-verified)
- Magento 2 / Mage-OS