Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Datafaker Laravel Package

bagisto/laravel-datafaker

Generate realistic fake data for Bagisto 2.3 during development: create customers, categories, and products (Simple, Virtual, Downloadable, Configurable). Install via Composer and run the bagisto:fake Artisan command to seed records.

View on GitHub
Deep Wiki
Context7

Getting Started

Start by installing the package via Composer and ensuring you’re running Bagisto v2.3.x (this package is tightly version-locked to Bagisto). Run the setup commands (config:cache, queue:batches-table, migrate), then use the bundled Artisan command php artisan bagisto:fake to interactively seed fake customers, categories, and products (Simple, Virtual, Downloadable, Configurable). The simplest first use case: generate 10 customers and 5 products for a local dev database to test checkout flows or catalog pages.

Implementation Patterns

Developers typically use this package in two main ways:

  1. Interactive CLI seeding: During early development or sprint setup, run bagisto:fake and select options (e.g., “Create 20 Simple products”) to populate test data quickly.
  2. Batch/programmatic seeding: Leverage the built-in queue support (introduced in v2.0.0) to generate large batches (e.g., 100 products) without blocking the request cycle—invoke via custom Artisan commands or seeders that dispatch jobs using FakeDataGeneratorJob. Integrate into DatabaseSeeder by calling the fake generator programmatically if you prefer deterministic test data per environment (e.g., always seed v2.3.0 fixtures). Ideal for staging environments or automated CI seeding before test suites.

Gotchas and Tips

  • Version lock is strict: This package only supports one Bagisto major.minor version at a time (e.g., v2.3.0 of this package = Bagisto v2.3.x). Upgrading Bagisto requires matching faker versions—check composer.json’s require before updating.
  • Locale/channel subtleties: Though v2.1.0 fixed locale/channel issues, remember: products always tie to a channel and locale; if your test data needs multilingual attributes, seed locales first and verify attribute fallbacks in the admin UI.
  • SKU uniqueness: Conflicts can occur if you run the faker multiple times without cleaning the DB. Use php artisan db:wipe or clear products, customers, categories, and related tables before reseeding—or hook into Laravel’s Database::beforeStopping() to reset cleanly.
  • Configurable products: Generating them correctly is nuanced (requires associated simples and attribute combinations). Use the CLI menu’s “Configurable” option instead of bypassing the generator—it handles variant SKUs and attribute value resolution per the v2.3.0 bug fixes.
  • Debugging failures: Queue failures (e.g., in batch seeding) log to failed_jobs. Check the job payload for attribute code mismatches—the package resolves attribute IDs dynamically by code, and custom attributes missing in the DB will break seeding.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport