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
Eloquent Model Generator

Eloquent Model Generator Laravel Package

krlove/eloquent-model-generator

Generates Eloquent model classes from existing database tables. It inspects your schema and creates models with proper fillable fields, table names, primary keys, and relationships, saving time when working with legacy databases or reverse-engineering an existing application.

Deep Wiki
Context7

Eloquent Model Generator

Frequently asked questions about Eloquent Model Generator
How do I install krlove/eloquent-model-generator in a Laravel project?
Install it with Composer as a development dependency, for example using composer require --dev krlove/eloquent-model-generator, then configure the database connection the generator should introspect. Because it is a scaffolding tool, keep it out of production builds and run it locally or in a controlled CI job. Check the package README for the exact Artisan command and supported options for your version.
Does krlove/eloquent-model-generator support Laravel 10 and PHP 8.2?
Compatibility depends on the package's Composer constraints, and because the package is archived you should not assume support for newer Laravel or PHP releases. Validate the constraints against your target versions before adoption, and pin to a known working release rather than using a floating constraint. If Composer conflicts arise, run the generator in an isolated container or fork it behind an internal namespace.
Is krlove/eloquent-model-generator safe to use in production?
No, it should not be deployed as part of the production application. It is a dev-time scaffolding tool that reads your schema and writes model classes; the generated models become application-owned source code. Keep the package in require-dev, commit the generated models after review, and exclude the tool from production builds.
How does the generator handle enums, composite keys, JSON columns, and other advanced schema features?
Schema introspection edge cases such as enums, composite keys, generated or virtual columns, JSON, spatial types, soft deletes, casts, and relationship inference are the main technical risk. The generator may produce incomplete or incorrect models for nonstandard columns, so test it against representative tables from your actual schema. Treat its output as a starting point and manually add casts, relationships, and any custom behavior.
Can I regenerate models without overwriting my hand-edited Eloquent models?
Regeneration can overwrite hand-edited models unless you isolate the output and review diffs. Generate into a temporary directory or a branch, compare the results with your existing models, and only merge the changes you want. Document a generation policy and avoid running the generator continuously against directories that contain owned, customized code.
Which database engines and versions does krlove/eloquent-model-generator support?
The package introspects an existing relational schema, so support depends on its doctrine or database introspection layer and on the engine version you run. Validate it against the exact database engine and version in scope, especially if you use PostgreSQL-specific types, MySQL enums, or generated columns. Large or unusual schemas may need batching and extra manual review.
Is krlove/eloquent-model-generator still maintained?
The package is archived, so upstream maintenance is effectively frozen. There are no upstream security fixes, Laravel or PHP compatibility updates, or vendor support. If you adopt it, plan to pin, fork, or vendor it and assign internal ownership for compatibility and bug fixes.
How should I test generated Eloquent models before committing them?
Run the generator against two or three representative tables in a branch and compare the output with your team's conventions for table names, primary keys, timestamps, fillable and guarded fields, casts, and relationships. Add a post-generation cleanup checklist or script, then write model tests that exercise relationships, casts, and queries. Commit only reviewed models as normal application code.
What are good alternatives to krlove/eloquent-model-generator?
Alternatives include Laravel's own schema and model conventions, migration-first workflows, and other model-generation or IDE-helper packages that are actively maintained. If your schema is legacy and database-first, you can also generate models with a custom script or a maintained fork. Evaluate maintenance status and Laravel version support before choosing an alternative.
How do I configure the database connection for the model generator?
Point the generator at a controlled database connection that contains the schema you want to introspect, typically through your Laravel database configuration. Use a local or CI-safe connection rather than a production database, and restrict the tables or schemas in scope. After generation, review the output for correct table names, primary keys, and relationship inference.
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.
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core
nodisrupt/laravel-agent
sierratecnologia/media-manager