krlove/code-generator
krlove/code-generator is a Laravel package that scaffolds PHP classes from your existing database schema, automating model and related boilerplate so you can skip repetitive hand-written code and keep generated classes consistent with your tables.
krlove/code-generator is the engine layer for generating PHP classes (models, DTOs, repositories) directly from an existing database schema, with per-table class mapping, naming strategies, type mapping, and customizable templates. The decision it informs is not "should we write a code generator" but "should we write one from scratch, fork this, or buy an admin/CRUD platform."Adopt or borrow it when:
Look elsewhere when:
For executives: This is a small, free, development-time utility that turns an existing database into typed PHP classes automatically. It is not something we ship to customers, so it carries no runtime or security exposure in production. It is useful as a starting point and pattern, not as a dependency we adopt on faith: the project is archived and unmaintained, so the realistic proposal is "fork it, pin it, and own roughly 1–2 engineer-days of work," not "add it to the stack." Expected payoff is faster legacy-schema migration and cheaper onboarding; the cost of being wrong is low and reversible.
For engineering: Treat it as a reference implementation for schema-driven codegen. Vendor or fork, add it as a dev-only dependency behind a console command, generate into a clearly marked output namespace, and keep generated code out of hand-edited paths (or use a "generate once, then own it" convention). Validate against our actual PHP/Laravel versions before committing — no releases since Feb 2022 means compatibility is an assumption, not a guarantee. Do not put it on a critical path without a named owner. If the templates fight us, the fallback is a few hundred lines of our own generator using the same idea.
How can I help you explore Laravel packages today?