caminodeldev/laravel-api-scaffold
A Laravel scaffolding package for building APIs faster: generate boilerplate controllers, routes, resources, requests, and validation so new JSON endpoints stay consistent and ready to extend. Great for prototyping and starting projects with a clean, conventional structure.
belongsTo / hasMany on both sides of a relationship, so generated APIs are usable for nested resources out of the box. This shortens the "schema exists → demoable API" interval, which is typically the expensive part of an early milestone.belongsTo / hasMany from real foreign keys and explicitly does not generate belongsToMany or polymorphic relations. That's a useful forcing function in design reviews — if a domain needs many-to-many, you know it's hand-written work, not generated work, and can plan capacity accordingly.Carbon for timestamps, Collection<int, Model> for inverse relations) gives IDE/static-analysis coverage for free. That affects decisions about adopting PHPStan/Larastan or IDE helper tooling — this partially replaces them for generated models.string (matching Laravel's decimal:2 cast) rather than float is the correct default for currency and financial amounts. This is a policy decision the PM can endorse rather than debate: no floating-point money in generated models unless a team explicitly opts in.--force regeneration is the workflow, adopting this package implies a decision that generated models are not the place for hand-written business logic. That has downstream consequences for where custom code lives (services, actions, or a separate layer) and should be settled before rollout, not after.Adopt when most of these hold:
belongsTo / hasMany output.scaffold:model / scaffold:api with --force) after schema changes.Look elsewhere or defer when:
--force regeneration conflicts with hand-edited models; if the team won't adopt a service/action layer, this becomes a footgun.For executives: This release moves our scaffolding tool from generating endpoints to generating the data layer. It now reads foreign keys in the database and writes the corresponding Eloquent relationships in both directions, plus structured type documentation on every generated model. Practically: the CRUD-and-relationships work that currently takes an engineer a day or more per resource becomes a command. It works on both MySQL and PostgreSQL, verified against real consumer projects with passing tests. It's a pre-1.0 package — we pin the version, review regenerated diffs, and keep hand-written logic out of generated files — but the direction is a meaningful reduction in boilerplate cost across our API surface.
For engineering: v0.4.0 adds FK introspection for MySQL/MariaDB and PostgreSQL, emitting belongsTo on child models and inverse hasMany on parent models, with imports added only when used. Models now carry PHPDoc for columns and relationships, including Collection<int, Model> for inverse relations and string for decimals to match decimal:2 casting. Behavior is gated by a new models config block (generate_relationships, generate_phpdoc, phpdoc_decimal_type), so we can adopt incrementally. Package suite is at 58 tests / 274 assertions, with end-to-end validation on both drivers. Two operational notes: regenerating requires --force and will overwrite models, so custom logic belongs in a service layer; and Octane/Swoole deployments need optimize:clear + octane:reload after config publish or regeneration. Upgrade is composer require caminodeldev/laravel-api-scaffold:^0.4.0 -W, then refresh published config and clear caches. Not included: belongsToMany and polymorphic relations — those remain manual.
How can I help you explore Laravel packages today?