Weave 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

Factory Generator Laravel Package

laravel-shift/factory-generator

Generate Laravel model factories automatically from your existing database schema. This Laravel Shift package inspects table columns and writes realistic Faker-based definitions, saving hours when adding tests or seed data to legacy applications.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit laravel-shift/factory-generator is a developer-time code generation tool, not a runtime dependency. It exposes Artisan commands (e.g. generate:factory) that introspect Eloquent models and the underlying schema, then emit database/factories/*.php classes. Architecturally it sits entirely outside the request lifecycle and should be installed as require-dev only. That makes it a low-coupling fit for any Laravel application, regardless of domain architecture — it produces standard Laravel factory classes that the framework itself consumes.

Integration feasibility v2.3 adds Laravel 13.x compatibility, which is the gating item for teams on (or moving to) Laravel 13. Integration is a single Composer dev dependency plus one or more Artisan invocations; generated output is reviewed and committed like hand-written code. No service provider configuration, no migrations, no schema changes. Feasibility is high, with the main constraint being whether the underlying schema-introspection dependency chain supports the target database driver and Laravel 13's schema grammar.

Technical risk

  • Codegen fidelity (primary risk): generated factories are a first-pass scaffold. Column-to-Faker mappings, enum handling, JSON/array columns, ULID/UUID keys, polymorphic relations, and unique constraints are common sources of subtly wrong output. Bad factories fail quietly by producing unrealistic or colliding test data.
  • Laravel 13 maturity: the compatibility PR is new. Laravel 13 is a fresh major, and third-party introspection layers (schema/DBAL) often lag on grammar and type changes. Treat v2.3 as "declared compatible," not "proven at scale."
  • Bus factor / support model: single-vendor open source (Laravel Shift) with no SLA and an issue-driven backlog. Acceptable for a dev-only tool; not acceptable if it were load-bearing in CI.
  • Low blast radius: because it never ships to production and its output is committed source, a failure is recoverable by deleting generated files and hand-editing.

Key questions

  1. Does v2.3's Laravel 13 support cover the schema grammar changes, or only the framework version constraint in composer.json?
  2. Which database drivers are validated (MySQL, Postgres, SQLite) and does our primary driver match?
  3. How does the generator handle enums, JSON columns, casts, and polymorphic relationships — and are those handling paths covered by the package's test suite?
  4. Is there an explicit support policy tying v2.x to Laravel 13's support window?
  5. What is the maintainer's release cadence over the last 12 months, and are there open issues affecting our schema patterns?

Integration Approach

Stack fit Requires Laravel 13.x (per this release) and the PHP version Laravel 13 mandates. Installed via composer require --dev laravel-shift/factory-generator:^2.3. Because it is dev-only, it does not affect production autoloading, deploy artifact size, or runtime dependency surface. It complements — does not replace — laravel/framework's native make:factory and existing hand-written factories.

Migration path

  1. Land the Laravel 13 application upgrade first; do not bundle the generator bump into the framework upgrade PR.
  2. Add ^2.3 as a dev dependency and verify Composer resolves cleanly against the existing lockfile.
  3. Run generation in batches against a curated list of models (start with 3–5 representative models covering relations, enums, and JSON columns) before generating repo-wide.
  4. Review every generated file as a code review artifact; commit only after correcting Faker mappings, seeding relationships, and adding states.
  5. For pre-existing factories, generate into a scratch path and diff — do not overwrite.

Compatibility Confirm the lockfile has no conflict with the schema-introspection/DBAL version pinned by the framework. Validate against the same database driver used in CI so generated output reflects production column types. Check for conflicts with other dev tooling that also introspects models (e.g. IDE helper generators) — none expected, but both hook model discovery.

Sequencing Framework upgrade → dependency addition → pilot generation → review/curation → bulk generation → CI wiring. Keep the generator out of the deploy pipeline entirely; it is a local/one-off tool. If regeneration is desired periodically, gate it behind a manual, reviewable PR workflow rather than automation that commits directly.

Operational Impact

Maintenance Near-zero steady-state cost. The tool is used to bootstrap coverage and then largely goes dormant; generated factories become ordinary source files maintained by the team. Budget a one-time curation effort proportional to model count — realistically minutes per model plus review time. Revisit the version pin only when the framework majors again.

Support Community-supported open source with no vendor SLA. Mitigation is straightforward given the low blast radius: pin the exact version, vendor a patch locally if a critical generation bug appears, and fall back to hand-written factories. Do not place the generator on any critical path.

Scaling Not a runtime scaling concern. Generation cost scales linearly with model count and schema complexity; even large applications (hundreds of models) complete in a single local run. The real scaling limit is human review bandwidth, not the tool.

Failure modes

  • Silent incorrect output: plausible-but-wrong Faker values or missing foreign keys produce green tests with unrealistic data. Detect via review and a smoke test that instantiates each generated factory.
  • Unique constraint collisions: generated values for unique columns may not be unique; tests become flaky. Detect via repeated factory invocation in the smoke test.
  • Generation crash on unsupported column types: fails loudly and is contained to the run.
  • Schema drift: factories generated once and never revisited diverge from schema changes; treat as normal test-suite maintenance debt.
  • Version-constraint regression: a future Laravel major drops out of the supported range and blocks the upgrade. Track this as an upgrade-checklist item, not a surprise.

Ramp-up Very low. One Artisan command plus a short team convention: "generated output is a draft, never merged unreviewed." A 30-minute walkthrough covering the command, the review checklist (relations, enums, JSON, unique columns), and the --dev installation discipline is sufficient for the whole team. No specialist knowledge required.

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.
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle
glavweb/extra-bundle
glavweb/api-bundle
glavweb/admin-bundle