pepijnolivier/eloquent-model-generator
Generate Eloquent model classes directly from your database tables. This Laravel package inspects your schema and scaffolds models with fillable fields, relationships, casts, and docblocks, cutting boilerplate and speeding up development.
Architecture fit. This is a build-time/dev-time codegen tool, not a runtime dependency. It sits in require-dev, exposes an Artisan command that introspects an existing database schema and renders Eloquent model classes from Blade templates. For us that's a clean fit: zero production surface area, no middleware, no service container hooks beyond package auto-discovery, no background workers. The blast radius is limited to the files it writes, and those files are committed and reviewable before they ever reach production.
Integration feasibility. Low. Standard Laravel package shape (service provider + publishable config + console command). Install is a one-line composer command, config is tunable (namespace, output path, base class, relation detection, naming strategy), and templates are Blade files we can override. Any Laravel engineer can read the command output and understand what happened. The main unknowns are our DB engine/version and how faithfully it maps exotic column types.
Technical risk.
app/Models can clobber hand-edited models. We must verify default behavior is "skip existing" or run it into a scratch namespace first.Key questions for the spike.
HasFactory, SoftDeletes), cast conventions, and docblock style?Stack fit. Appropriate for any Laravel 9+ / PHP 8.1+ codebase. It's engine-agnostic in intent but DB-driver-sensitive in practice — confirm against the driver we actually run. Best value when we have a schema but not models: legacy DB modernization, read-only replicas we're fronting with an API, or a database-first team that designs in SQL rather than migrations.
Migration path (three scenarios).
app/Models/Generated (or a scratch branch), review the diff against the current hand-written models, and merge selectively. Never generate straight over a living app/Models.Compatibility checks before committing.
Sequencing.
diff -r against committed models, fail the build on unexplained drift. Only after the workflow is stable.Maintenance. Near-zero production maintenance (no runtime component). Ongoing cost is a dev-dependency bump on each Laravel/PHP upgrade plus periodic template upkeep as our conventions evolve. Expect to own the templates ourselves; upstream won't follow our style.
Support. No commercial support, no meaningful downstream ecosystem to lean on, single maintainer. Budget for the possibility of fork-and-patch — the templates and config are ours anyway, so a fork is a small lift. Assign a named internal owner (backend platform or chapter lead) so it doesn't become orphaned.
Scaling. Generation cost is linear in table count and runs in seconds to low minutes even on wide schemas, so it scales fine as a one-shot or on-demand tool. It does not scale as an always-on process; if we turn it into a CI drift gate, we take on the cost of keeping generated output in sync with every schema change, which can become noisy.
Failure modes and mitigations.
app/Models; rely on git for recovery.Ramp-up. ~1–2 hours for an experienced Laravel engineer to spike and evaluate; ~1 day to establish the tuned workflow plus a short README (how to run, how to override templates, which tables are excluded, the review checklist). No new conceptual knowledge needed beyond Blade and Eloquent conventions, both of which our team already has.
Bottom line for the TPM view. A tactical accelerator, not a platform bet. Adopt it as a dev-only bootstrap tool with template ownership and a strict "generate to scratch, review, merge" policy, expect to fork or discard it, and don't let it become a CI gate until the workflow has proven itself over a couple of schema changes.
How can I help you explore Laravel packages today?