是否有一种方法来创建子模块在Laravel


Is there a way to create submodules in Laravel?

我正在开发一个网站与laravel和我使用的模块,但我想知道,如果我能使这些模块有子模块就像

laravel-app/
    app/
    bootstrap/
    vendor/
    modules/
      ├── Admin/
          ├── Assets/
          ├── Config/
          ├── Console/
          ├── Database/
              ├── Migrations/
              ├── Seeders/
         ├── Entities/
         ├── Http/
              ├── Controllers/
              ├── Middleware/
              ├── Requests/
              ├── routes.php
         ├── Providers/
             ├── BlogServiceProvider.php
         ├── Resources/
             ├── lang/
             ├── views/
         ├── Repositories/
         ├── Tests/
         ├── composer.json
         ├── module.json
         ├── start.php
         |──modules
            |──AdminConfig
               ├── Assets/
               ├── Config/
               ├── Console/
               ├── Database/
                 ├── Migrations/
               ├── Seeders/
               ├── Entities/
               ├── Http/
                 ├── Controllers/
                 ├── Middleware/
                 ├── Requests/
               ├── routes.php
               ├── Providers/
                 ├── BlogServiceProvider.php
               ├── Resources/
                 ├── lang/
                 ├── views/
              ├── Repositories/
              ├── Tests/
              ├── composer.json
              ├── module.json
              ├── start.php

我通过更改config/module.php中的文件来实现这一点,但它不会与php artisan serve一起运行

Laravel的文档提供了一些关于目录结构的信息。

应用程序的大部分都位于app目录中。默认情况下,此目录位于App下的命名空间,并由Composer使用PSR-4自动加载标准自动加载。

换句话说,只要遵循PSR-4,你就可以按照自己的意愿构建应用程序。因此,我会让你的模块在app目录中使用适当的PSR-4命名空间。

的例子:

namespace App'Module1'Services;
namespace App'Module2'Services;
namespace App'Services; //For common services

然而,在我的应用程序中,我更喜欢在现有的目录中创建"module"。

的例子:

namespace App'Services'Module1;
namespace App'Services'Module2;
namespace App'Services; //For common services