Generators
Generators are the scaffolding engine behind Modularous make:* and make:route commands. They produce the full set of PHP and JS files that constitute a new module route, plus the test scaffolding for both the frontend and backend.
Class Hierarchy
Generator (abstract) ← NwidartGenerator + ReplacementTrait
├── RouteGenerator ← full-stack route scaffolding (primary generator)
├── StubsGenerator ← stub-only regeneration (fix/patch workflow)
├── VueTestGenerator ← Vitest/Jest test file scaffolding
└── LaravelTestGenerator ← PHPUnit test file scaffoldingGenerator Reference
| Generator | Source | Responsibility |
|---|---|---|
Generator | Generators/Generator.php | Abstract base — shared properties, module resolution, config path helpers |
RouteGenerator | Generators/RouteGenerator.php | Creates the full set of files for a new module route (model, migration, controller, repository, request, translations, permissions) |
StubsGenerator | Generators/StubsGenerator.php | Regenerates stub-based files only; supports selective overwrite via only/except lists |
VueTestGenerator | Generators/VueTestGenerator.php | Scaffolds a Vitest/Jest test file for a Vue component, composable, utility, or store |
LaravelTestGenerator | Generators/LaravelTestGenerator.php | Scaffolds a PHPUnit Unit or Feature test file |
How Generators Are Invoked
Generators are not called directly in application code — they are orchestrated by Artisan commands:
| Command | Generator |
|---|---|
modularous:make:route | RouteGenerator |
modularous:fix:route | RouteGenerator (with --fix) |
modularous:make:stubs | StubsGenerator |
modularous:make:test:vue | VueTestGenerator |
modularous:make:test:laravel | LaravelTestGenerator |