lauchoit/laravel-hex-mod
Composer 安装命令:
composer require lauchoit/laravel-hex-mod
包简介
Modular scaffolding generator for Laravel (Hexagonal Architecture)
README 文档
README
Laravel Hex Mod
⚙️ A modular scaffolding generator for Laravel based on Hexagonal Architecture (Ports & Adapters).
📦 Installation
You can install the package via Composer:
composer require lauchoit/laravel-hex-mod --dev
🚀 What It Does
This package generates a modular Laravel structure based on Hexagonal Architecture, automating the creation of:
- ✅ Domain Entities & EntitySource (Model of Laravel)
- ✅ Application UseCases
- ✅ Interface Adapters (Controllers, Repositories, Requests, Resources)
- ✅ Eloquent Models, Migrations, and Factories
- ✅ Automatic Unit & Feature Tests
- ✅ Route injection & AppServiceProvider bindings
- ✅ Shared folder
🚀 What It Does
This package scaffolds a complete Laravel module following Hexagonal Architecture, including:
src
├── Client
│ ├── Application
│ │ └── UseCases
│ │ ├── CreateClientUseCase.php
│ │ ├── DeleteByIdClientUseCase.php
│ │ ├── FindAllClientUseCase.php
│ │ ├── FindByIdClientUseCase.php
│ │ └── UpdateByIdClientUseCase.php
│ ├── Domain
│ │ ├── Entity
│ │ │ ├── Client.php
│ │ │ └── ClientSource.php
│ │ ├── Exceptions
│ │ │ └── ClientNotFoundException.php
│ │ ├── Mappers
│ │ │ └── ClientMapper.php
│ │ └── Repository
│ │ └── ClientRepository.php
│ ├── Infrastructure
│ │ ├── Controllers
│ │ │ └── ClientController.php
│ │ ├── Model
│ │ │ └── Client.php
│ │ ├── Repository
│ │ │ ├── ClientRepositoryImpl.php
│ │ │ └── UseCases
│ │ │ ├── CreateClientUseCaseImpl.php
│ │ │ ├── DeleteByIdClientUseCaseImpl.php
│ │ │ ├── FindAllClientUseCaseImpl.php
│ │ │ ├── FindByIdClientUseCaseImpl.php
│ │ │ └── UpdateByIdClientUseCaseImpl.php
│ │ ├── Requests
│ │ │ ├── CreateClientRequest.php
│ │ │ └── UpdateClientRequest.php
│ │ ├── Resources
│ │ │ └── ClientResource.php
│ │ └── Routes
│ │ └── ClientRoutes.php
│ └── Tests
│ ├── Feature
│ │ ├── CreateClientTest.php
│ │ ├── DeleteByIdClientTest.php
│ │ ├── FindAllClientTest.php
│ │ ├── FindByIdClientTest.php
│ │ └── UpdateByIdClientTest.php
│ └── Unit
│ └── Domain
│ ├── Entity
│ │ ├── ClientSourceTest.php
│ │ └── ClientTest.php
│ └── Exceptions
│ └── ClientNotFoundExceptionTest.php
└── Shared
└── Responses
├── ApiResponse.php
└── ValidationResponse.php
🧱 Usage
You can run the command in different ways depending on your needs:
Basic Usage
php artisan make:hex-mod client
This command will generate a complete module for Client with default fields attribute1 and attribute2 all string.
With fields Usage
php artisan make:hex-mod client -f name,lastname,direction,description
This command will generate a complete module for Client with specific field, if your not provider type, the system makes field with a string type.
With fields and type Usage
php artisan make:hex-mod client -f name,lastname,direction,year:integer,registred_at:date,data:json,metadata:json
The type available are: string, integer, float, boolean, date, datetime, json, longText.
This command will generate a complete module for Client with specific field and type, if your not provider types, the system makes field with a string type.
Without Tests
php artisan make:hex-mod client --skip-test
If you provide the --skip-test option, the generator will skip creating tests for the module.
Route
The generator automatically creates a route file for the module, which you can find in src/Client/Infrastructure/Routes/ClientRoutes.php.
- You can customize the routes as needed, and they will be automatically loaded by the application.
- This route file is register automatically in the
bootstrap/app.phpof your Laravel application. - You can see the routes in the
php artisan route:listcommand.
🧪 Test Coverage
Note: you need to have the phpunit package installed and configured in your Laravel project to run the tests. You need run migratrions before runnig the tests.
The generator produces unit and feature tests for:
- Entity classes
- NotFound exceptions
- UsesCases feature scenarios
Run your tests:
php artisan test
🙌 Made with ❤️ by LauchoIT
Feel free to contribute or suggest features via GitHub issues or PRs.
📜 License
This package is open-sourced software licensed under the MIT license.
lauchoit/laravel-hex-mod 适用场景与选型建议
lauchoit/laravel-hex-mod 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 41 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 06 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 lauchoit/laravel-hex-mod 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 lauchoit/laravel-hex-mod 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 41
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 17
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-06-24
