nWidart / laravel-modules

Module Management In Laravel

Home Page:https://docs.laravelmodules.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Custom modules.paths.app_folder value not working

solomon-ochepa opened this issue · comments

image
When the config/modules.php value for modules.paths.app_folder is changed (from the default app/ to src/ for instance), the module will be generated using the old namespace format with the app\ path in lowercase.

image
The module composer.json didn't reflect the custom app_folder, it's still using app/.

image
The Service Provider and every other class were created with the wrong namespace. All the namespaces have the initial app\ segment and are in lowercase.

The custom app_folder 'src/' wasn't generated, instead the 'app/' is used.

Is there any workaround for this, please?
@nWidart @dcblogdev @alissn

Thanks for the love.

Please, I'd like you to reopen this issue as it hasn't been addressed. Sorry for the late response; I got carried away with work.

The modules.paths.app value is not reflected in the namespace, creating confusion between default and custom namespace.

Expected results

  1. 'app/'

    This is the default Laravel value and it's great we maintain it. However, the value should be reflected in the autoload.psr-4 namespace (key), and its corresponding path (value).

    Right now, the modules.paths.app is being forcefully removed from the namespace (ltrim(config('modules.paths.generator.model.path', 'app/Models'), config('modules.paths.app_folder', ''))), which makes all the options autoload.psr-4 keys look-alike ("Modules\\Example\\": "...",), that we can all agree it's a bad practice and opinionated way of coding an open source!

    Forcefully removing the modules.paths.app value from the namespace, and forcing all the options autoload.psr-4 keys look-alike will create confusion, and make it difficult to reverse engineer (converting a "namespace" to "path" and vice versa).

    "Modules\\Example\\App\\": "app/",
  2. 'src/'

    Here, the custom value (src) should be reflected in the autoload.psr-4 namespace, and the corresponding path.

    "Modules\\Example\\Src\\": "app/",
  3. '/'

    Here, the custom value (/) indicates no app/ path, the module's root path will be used instead.

    "Modules\\Example\\": "/",
  4. ''

    Here, the modules.paths.app value is empty (``), and will therefore fall back to the default value (`app/`).

    "Modules\\Example\\App\\": "app/",

Thanks for your continuous dedication, contribution and support for this package.
@nWidart @dcblogdev @alissn