定制 lauchoit/laravel-hex-mod 二次开发

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

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

lauchoit/laravel-hex-mod

最新稳定版本:v1.0.2

Composer 安装命令:

composer require lauchoit/laravel-hex-mod

包简介

Modular scaffolding generator for Laravel (Hexagonal Architecture)

README 文档

README

LauchoIT Logo

Laravel Hex Mod

⚙️ A modular scaffolding generator for Laravel based on Hexagonal Architecture (Ports & Adapters).

License Packagist Made by LauchoIT

📦 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.php of your Laravel application.
  • You can see the routes in the php artisan route:list command.

🧪 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.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-06-24