Skip to content

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 scaffolding

Generator Reference

GeneratorSourceResponsibility
GeneratorGenerators/Generator.phpAbstract base — shared properties, module resolution, config path helpers
RouteGeneratorGenerators/RouteGenerator.phpCreates the full set of files for a new module route (model, migration, controller, repository, request, translations, permissions)
StubsGeneratorGenerators/StubsGenerator.phpRegenerates stub-based files only; supports selective overwrite via only/except lists
VueTestGeneratorGenerators/VueTestGenerator.phpScaffolds a Vitest/Jest test file for a Vue component, composable, utility, or store
LaravelTestGeneratorGenerators/LaravelTestGenerator.phpScaffolds 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:

CommandGenerator
modularous:make:routeRouteGenerator
modularous:fix:routeRouteGenerator (with --fix)
modularous:make:stubsStubsGenerator
modularous:make:test:vueVueTestGenerator
modularous:make:test:laravelLaravelTestGenerator