定制 fnnaeem/module-architecture-generator 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

fnnaeem/module-architecture-generator

Composer 安装命令:

composer require fnnaeem/module-architecture-generator

包简介

Laravel Module Generator Package

README 文档

README

A Laravel 12+ module generator for creating, managing, and deleting modules with clean architecture. Supports Controllers, Models, Services, Repositories, Views, Routes, Requests, Tests, Migrations, and Middleware. Compatible with Laravel 12+ bootstrap structure or older Kernel.php structure.

Features

  • Full module generator: Controllers, Services, Repositories, Models, Requests, Tests, Views, Routes, Migrations
  • API-only or CRUD modules
  • Module activation/deactivation with middleware
  • Automatic ServiceProvider registration
  • Auto PSR-4 autoload configuration
  • Laravel 12+ and older versions support
  • Safe module deletion with table data check

Installation

Run the command below to install via Composer

composer require fnnaeem1881/module-architecture-generator

Run composer dump-autoload:

composer dump-autoload

The package registers itself automatically via ModuleLoaderServiceProvider.

Commands

Command Description
php artisan make:module {name} Create a new full module
php artisan make:module {name} --crud Create a CRUD module with views
php artisan make:module {name} --api Create API-only module
php artisan make:module {name} --migration Create migration for the module
php artisan make:module {name} --request Generate FormRequest classes
php artisan make:module {name} --test Generate test file for module
php artisan make:module {name} --force Overwrite existing module
php artisan make:module {name} --delete Delete the module safely
php artisan make:module {name} --deactivate Deactivate the module
php artisan make:module {name} --activate Activate the module

Module Structure

app/Modules/ModuleName/
├── Controllers/
├── Services/
├── Repositories/
├── Models/
├── Requests/
├── Views/
├── Routes/
├── Migrations/
├── Tests/
└── ModuleNameServiceProvider.php

Example:
app/Modules/Order/
├── Controllers/
│   └── OrderController.php
├── Middleware/
│   └── OrderActiveMiddleware.php
├── Models/
│   └── Order.php
├── Repositories/
│   └── OrderRepository.php
├── Requests/
│   ├── OrderStoreRequest.php
│   └── OrderUpdateRequest.php
├── Routes/
│   ├── api.php
│   └── web.php
├── Services/
│   └── OrderService.php
├── Tests/
│   └── OrderTest.php
├── Views/
│   ├── index.blade.php
│   ├── create.blade.php
│   └── edit.blade.php
├── Migrations/
│   └── 2026_01_26_000000_create_orders_table.php
└── OrderServiceProvider.php

Middleware

  • Each module has {ModuleName}ActiveMiddleware created automatically.
  • Middleware is registered in either app/Http/Kernel.php (if exists) or bootstrap/app.php (Laravel 12+).

Module Status

  • The module status (active/inactive) is stored in app/Modules/module_status.php.
  • Deactivated modules will throw a 404 when accessed.

Composer Autoload

  • Adds App\Modules\ namespace to composer.json PSR-4 autoload.
  • Run composer dump-autoload after creating modules.

Example Usage

php artisan make:module Order          # Full module
php artisan make:module Order --crud   # CRUD module
php artisan make:module Order --force   # Overwrite existing module if exists
php artisan make:module Order --api    # API only module
php artisan make:module Order --delete # Delete module
php artisan make:module Order --deactivate # Deactivate
php artisan make:module Order --activate   # Activate
php artisan make:module Order --test   # Generate Test files
php artisan make:module Order --migration   # Generate migration file inside the module
php artisan make:module Order --request   # Generate FormRequest files for store & update

Notes

  • Laravel 12 uses bootstrap/app.php for middleware registration instead of app/Http/Kernel.php.
  • ModuleLoaderServiceProvider loads only active modules automatically.

License

Released under the MIT License attached with this code.

Copyright

Made with ❤️ by Mehedi Hasan

统计信息

  • 总下载量: 2
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2026-01-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固