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
Laravel Models Generator

Laravel Models Generator Laravel Package

axn/laravel-models-generator

Generate Eloquent models directly from your existing database schema. Laravel Models Generator inspects your tables and creates ready-to-use model classes with fillable fields, relationships, and more, making it easy to bootstrap new projects or reverse-engineer legacy databases.

View on GitHub
Deep Wiki
Context7

Eloquent model generation from the database.

Frequently asked questions about Laravel Models Generator
How do I install axn/laravel-models-generator?
Install it with Composer as a development dependency using composer require --dev axn/laravel-models-generator. It is a dev-time code generation tool, so it does not need to be present in your production runtime. After installation, run the package's model generation command against the database connection you want to introspect. Review the configuration options for namespace, output path, and table selection before generating files.
Does it support Laravel 11 or Laravel 10?
Version 8.0.0 of axn/laravel-models-generator requires Laravel 12 or newer and Doctrine DBAL 4 or newer. Laravel 10 and Laravel 11 are hard-excluded at the Composer level in that release. If you are on an older Laravel version, you would need to pin an earlier package release or maintain a fork. Plan for re-pinning when your Laravel version changes.
Which databases does axn/laravel-models-generator support?
The package supports MySQL, PostgreSQL, and SQLite connections. It inspects your existing tables, columns, and foreign keys through Doctrine DBAL to produce Eloquent model classes. Schema introspection behavior for unusual column types should still be verified against your own database before relying on the generated output.
Does it generate Eloquent relationships automatically?
Yes, the generator detects foreign keys and builds belongsTo and hasMany relationships between the generated models. This is especially useful when reverse-engineering a legacy schema with many tables. Relationship inference is documented around foreign key constraints, so verify whether pivots, polymorphic relations, or heuristic relationships in your schema are covered by your version.
Can I regenerate models without overwriting my changes?
The package advertises overwrite-safe generation for repeatable workflows, but the exact overwrite semantics are not fully documented in the release notes. Before regenerating models that you have hand-edited, test the behavior on a branch or back up the output directory. Treat generated files as a starting point and confirm how the tool handles existing files in your environment.
What is included in the generated model classes?
Generated models include $fillable fields, casts, and timestamp settings inferred from your database columns. When foreign keys are present, the generator also adds belongsTo and hasMany relationship methods. The goal is to give you ready-to-use Eloquent classes instead of hand-written boilerplate for every table. You can then customize the generated models for your application's domain logic.
Can I configure the namespace and output path?
Yes, the package exposes configuration for the generated model namespace, the output path, and which tables to include. That makes it possible to target a specific application namespace or generate models into a dedicated directory. Use table selection to avoid generating models for migrations, pivot tables, or other tables you do not want as Eloquent models. Review the configuration before the first run so the generated files land where your application expects them.
Is axn/laravel-models-generator safe to use in production?
The package itself is a development-time scaffolding utility and should be installed as a Composer dev dependency. It is not intended to run in the production request path and has no runtime coupling to your application. The generated model classes are normal application code and can be deployed like any other model, but you should review and test them before using them in production. Avoid running code generation directly against a production database without a backup and a review step.
Is axn/laravel-models-generator actively maintained?
The 8.0.0 release is a deliberate major-version bump that drops end-of-life Laravel support, which indicates the repository is still being maintained. However, the project has a very small footprint, with roughly 23 stars and no dependents, so it relies on a single-maintainer continuity model rather than broad community triage. There is no published support policy or cadence for major bumps, so budget time for re-pinning when Laravel versions change. Treat it as a focused utility rather than a heavily supported framework package.
What are alternatives to generating models from an existing database?
You can hand-write models, use Laravel's built-in make:model command for new models, or evaluate other schema introspection and code generation tools. axn/laravel-models-generator is best suited to database-first or legacy-schema onboarding where manually writing dozens or hundreds of models is the real cost. It is a poor fit for greenfield migration-first projects or teams with heavy custom model behavior. Compare alternatives against your Laravel version, database engine, and whether you need 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.
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo
bernskioldmedia/laravel-harvest
bernskiold/laravel-data-scrubber
bernskiold/laravel-currency-converter
bernskiold/laravel-campaign-monitor
bernskioldmedia/laravel-autotranslate
siberfx/telegram-bot
roy-sandip/laravel-view-extended
gregsphotography/site-builder-core
roy-sandip/laravel-view
anodyne/blade-fluentui-icons
webx-ui/module-catalog-collections