spiral/scaffolder
Spiral Framework scaffolder module for generating and wiring up application code. Provides scaffolding tools and templates to speed up project setup and common development tasks, with CI-tested quality (PHPUnit/Psalm) and documentation on spiral.dev.
Begin by installing the package via Composer (composer require spiral/scaffolder --dev). Once installed, register the loader in your bootstrap (bootstrap/app.php) by including Spiral\Scaffolder\Loader\Loader::class. The entry point is the php app.php CLI (Spiral’s console), where you’ll find scaffolding commands prefixed with scaffold:. Start with php app.php list scaffold to see available generators (e.g., scaffold:controller, scaffold:config, scaffold:migration). The first real use case is generating a new module’s skeleton with php app.php scaffold:module YourModuleName, which creates a self-contained module directory (src/YourModule) with core files like Module.php, Config.php, and routes.
Typical workflows involve using scaffolder during onboarding or feature development to enforce structure. For example:
scaffold:controller with --resource to generate a full resource controller (index, create, store, etc.) alongside a stub view and request validation class.scaffold:config to generate namespaced config files under config/YourModule/, then symlink them into the main app/config/ if desired.Spiral\Scaffolder\Template\AbstractTemplate and register them as services—this allows teams to codify internal conventions (e.g., service providers with injection helpers).spiral/framework’s module system: after scaffolding, scaffold:module output automatically participates in Spiral’s auto-discovery and config loading when the module is loaded via Modules::addModule().--force is often needed to overwrite existing files during refactoring, but always back up or version-control scaffolds first—accidental overwrites are common.generate() and use $this->writeFile() instead of direct filesystem calls for clean rollback via the internal transaction system.How can I help you explore Laravel packages today?