diff --git a/config.php b/config.php index b731843..3f330d3 100644 --- a/config.php +++ b/config.php @@ -1,7 +1,61 @@ 'app-modules', + /* + |-------------------------------------------------------------------------- + | Modules Namespace + |-------------------------------------------------------------------------- + | + | This is the PHP namespace that your modules will be created in. For + | example, a module called "Helpers" will be placed in \Modules\Helpers + | by default. + | + | It his *highly recommended* that you configure this to your organization + | name to make extracting modules to their own package easier (should you + | choose to ever do so). + | + | If you set the namespace, you should also set the vendor name to match. + | + */ + 'modules_namespace' => 'Modules', + + /* + |-------------------------------------------------------------------------- + | Composer "Vendor" Name + |-------------------------------------------------------------------------- + | + | This is the prefix used for your composer.json file. This should be the + | kebab-case version of your module namespace (if left null, we will + | generate the kebab-case version for you). + | + */ + + 'modules_vendor' => null, + + /* + |-------------------------------------------------------------------------- + | Modules Directory + |-------------------------------------------------------------------------- + | + | If you want to install modules in a custom directory, you can do so here. + | Keeping the default `app-modules/` directory is highly recommended, + | though, as it keeps your modules near the rest of your application code + | in an alpha-sorted directory listing. + | + */ + + 'modules_directory' => 'app-modules', + + /* + |-------------------------------------------------------------------------- + | Base Test Case + |-------------------------------------------------------------------------- + | + | This is the base TestCase class name that auto-generated Tests should + | extend. By default it assumes the default \Tests\TestCase exists. + | + */ + 'tests_base' => 'Tests\TestCase', ]; diff --git a/src/Console/Commands/Make/MakeModule.php b/src/Console/Commands/Make/MakeModule.php index e58b1a5..02edf5e 100644 --- a/src/Console/Commands/Make/MakeModule.php +++ b/src/Console/Commands/Make/MakeModule.php @@ -84,10 +84,10 @@ public function __construct(Filesystem $filesystem, ModuleRegistry $module_regis public function handle() { - $this->module_name = strtolower($this->argument('name')); + $this->module_name = Str::kebab($this->argument('name')); $this->class_name_prefix = Str::studly($this->argument('name')); $this->module_namespace = config('app-modules.modules_namespace', 'Modules'); - $this->composer_namespace = strtolower($this->module_namespace); + $this->composer_namespace = config('app-modules.modules_vendor') ?? Str::kebab($this->module_namespace); $this->composer_name = "{$this->composer_namespace}/{$this->module_name}"; $this->base_path = $this->module_registry->getModulesPath().DIRECTORY_SEPARATOR.$this->module_name;