internachi / modularize
Installs: 257
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/internachi/modularize
Requires
- ext-json: *
- illuminate/support: ^10|^11|^12|dev-main|dev-master
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.71
- internachi/modular: *
- orchestra/testbench: ^8.34.0|^9.12.0|^10.1.0|11.x-dev|dev-main|dev-master
- phpunit/phpunit: ^10.5|^11.5|^12.5
README
Modularize
Traits for package authors to add internachi/modular support to their Laravel commands.
Installation
composer require internachi/modularize
Usage
Add the Modularize trait to your package commands:
use Illuminate\Console\Command; use InterNACHI\Modularize\Support\Modularize; class SomeCommand extends Command { use Modularize; public function handle() { if ($module = $this->module()) { // Command was called with --module, $module is a ModuleConfig class // with name, base path, namespaces, and helper methods. } } }
If you're using Laravel file generator commands, add the ModularizeGeneratorCommand trait:
use Illuminate\Console\GeneratorCommand; use InterNACHI\Modularize\Support\ModularizeGeneratorCommand; class MakeWidget extends GeneratorCommand { use ModularizeGeneratorCommand; // ... }
This adds a --module option to your command. When used, generated files are placed in the module directory with correct namespacing.