Custom modules.paths.app_folder value not working
solomon-ochepa opened this issue · comments
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.
The module composer.json
didn't reflect the custom app_folder, it's still using app/
.
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
-
'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 correspondingpath
(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 optionsautoload.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 thenamespace
, and forcing all the optionsautoload.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/",
-
'src/'
Here, the custom value (
src
) should be reflected in theautoload.psr-4
namespace
, and the correspondingpath
."Modules\\Example\\Src\\": "app/",
-
'/'
Here, the custom value (
/
) indicates noapp/
path, the module's root path will be used instead."Modules\\Example\\": "/",
-
''
Here, the
modules.paths.app
value is empty (``), and will therefore fall back to thedefault
value (`app/`)."Modules\\Example\\App\\": "app/",
Thanks for your continuous dedication, contribution and support for this package.
@nWidart @dcblogdev @alissn