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 Package

giacomomasseron/laravel-models-generator

Generate Eloquent models directly from an existing database with this Laravel artisan command. Supports MySQL, MariaDB, SQLite, PostgreSQL and SQLServer, plus polymorphic relations, UUID/ULID columns, enum, URI and JSON casting, and optional model factories.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Legacy modernization / brownfield Laravel adoption: Decide whether to port an existing PHP or database-backed app onto Laravel by reverse-engineering Eloquent models from the current schema. This can turn a multi-sprint scaffolding task into an afternoon, letting the team validate Laravel fit before committing to a full rewrite.
  • Build vs. buy for internal code generation: Avoid building an internal “schema-to-model” generator unless the team has very unusual conventions. This package already covers relationships, factories, casts, UUID/ULID handling, observers, global scopes, query builders, and configurable namespaces/paths under MIT.
  • Internal tools and admin panels over existing databases: For products where the database is the source of truth—reporting tools, back-office systems, migration dashboards—generated models and factories reduce the cost of standing up a Laravel API or admin layer.
  • Roadmap sequencing for data-heavy features: If a feature depends on dozens of existing tables, teams can generate a first-pass model layer early, then spend roadmap time on business logic, authorization, validation, and UX instead of boilerplate.
  • Test enablement: Generated factories make it cheaper to add integration tests around legacy schemas, supporting a “stabilize before change” roadmap.
  • Standardization decision: The rich config file lets a PM/tech lead decide on house conventions once—strict types, base model classes, fillable rules, enum/JSON/URI casting, excluded tables—and apply them consistently across generated models.
  • Risk containment decision: Because this is a development-time generator, not a runtime dependency, adoption risk is mostly limited to generated code quality and the generation workflow. That makes it easier to approve as a productivity tool rather than a platform bet.

When to Consider This Package

Consider it when:

  • The team uses Laravel 9–13 and an existing relational database is the source of truth.
  • The database uses a supported driver: MySQL, MariaDB, PostgreSQL, SQLite, or SQL Server.
  • The schema has enough structure—primary keys, foreign keys, timestamps, conventional naming—for relationship and fillable inference to be useful.
  • The team needs to bootstrap many models quickly, especially during legacy migration, proof-of-concept work, or internal tooling.
  • The team wants generated models to be PHPStan-friendly, use modern Laravel conventions, and include optional factories for testing.
  • The organization is comfortable treating generated code as a starting point that humans review and own, not as an oracle.
  • The team can pin a version, run generation in a branch, and review diffs before merging.

Look elsewhere or proceed with caution when:

  • The product is greenfield and code-first; Laravel migrations should define the schema, and generated-from-DB models add little value.
  • The schema is messy: missing foreign keys, inconsistent naming, polymorphic relations not captured in config, or tables that should not become Eloquent models.
  • The team needs rich domain models, DDD-style aggregates, or heavy custom behavior that a generator cannot infer.
  • The database driver is not supported, or the team depends on database features the package does not model well.
  • The organization requires vendor SLA, large community support, or strong adoption signals. This package has a small footprint—58 stars and zero dependents—so it should be treated as a focused utility, not an ecosystem-standard dependency.
  • The default config is used unmodified in a brownfield repo. In particular, clean_models_directory_before_generation defaults to true, which can be destructive if pointed at a directory containing handwritten models. Adoption should require a reviewed config with excludes, paths, and generation scope.

How to Pitch It (Stakeholders)

For executives: This is a free, MIT-licensed Laravel utility that reverse-engineers Eloquent models and factories from an existing database. It is best used as a one-time accelerator for legacy modernization or internal tooling—not as production runtime infrastructure. It can compress model scaffolding from days or weeks into minutes, reduce manual boilerplate errors, and let engineering spend roadmap time on business logic and user-facing work. Because it generates code that the team owns and reviews, the long-term dependency risk is low; the main risk is generated-code quality, which we mitigate with branch-based generation, diff review, pinned versions, and a deliberate configuration file.

For engineering: The package provides an Artisan command that generates models, optional factories, relationships, casts, and configurable model conventions from an existing schema. It supports Laravel 9–13, major relational drivers, polymorphic relationships, UUID/ULID columns, enums, URI/JSON casting, observers, global scopes, base model classes, and query builders. It is PHPStan level 9/10 compliant and follows modern Laravel model style. Treat it as a scaffold generator: review the output, exclude tables and columns explicitly, disable destructive directory cleaning or scope generation to a dedicated path, and fork/vendor if the small upstream project becomes inactive. The generated code remains usable even if the package is later dropped.

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.
xiloryx/log-collector
a21ns1g4ts/filament-stripe
la-php/laravel-admin
artisan-build/community-prompts
vleroy/smart
ayles-software/laravel-australian-public-holidays
cboxdk/laravel-id-spatie
cboxdk/laravel-id-billing
cboxdk/laravel-id-billing-bridge
simple-as-fuck/php-performance-log
hsluv/hsluv
seampact/codegen
seampact/hooks
seampact/ir
mehedimi/laravel-amp-mail
happones/laravel-vue-i18n-generator
jwerd/inertia-table
siberfx/flysystem-wasabi
hollyit/token-replace
ippanelcom/laravel-sdk