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.
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
Key questions
composer.json?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
^2.3 as a dev dependency and verify Composer resolves cleanly against the existing lockfile.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.
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
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.
How can I help you explore Laravel packages today?