定制 enfil/laravel-ddd-cqrs-modules 二次开发

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

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

enfil/laravel-ddd-cqrs-modules

Composer 安装命令:

composer require enfil/laravel-ddd-cqrs-modules

包简介

description

README 文档

README

To decompose the system, it is proposed to identify bounded business logic contexts and separate them into individual modules

Each module should be responsible for one related context and have a defined directory structure that determines the core layers

This package is built on top of nwidart/laravel-modules and generates the following module structure:

Domain - Domain layer

  • Src
  • Entity
  • UseCase
  • Repository
  • Service

Application - Application layer

  • Api
  • Service
  • Console
  • Listener
  • Provider

Infrastructure - Infrastructure layer

  • Config
  • Database
  • Repository
  • ReadModel

Presentation - Presentation layer

  • Http
    • Controller
    • Request
    • Middleware

Testing

Installation

Require packages

composer require enfil/laravel-ddd-cqrs-modules codeception/codeception codeception/module-asserts codeception/module-phpbrowser

Publish the package's configuration

php artisan vendor:publish --provider="Enfil\Laravel\DddCqrs\Modules\LaravelModulesServiceProvider"

Add this line to composer.json autoload

"autoload": {
  "psr-4": {
    ...
    "Modules\\": "modules/",
    ...
  }
},

Usage

As an example, let's take the Comments module for comments.

Let's assume that the list of main entities will be as follows:

  • Comment
  • Author

Module generation and CRUD

module:make-structure {MODULE_NAME} {ENTITY_NAMES*}

Let's call the command.

Creating a new module

php artisan module:make-structure Comments Comment Author

The command should generate the module structure, create the main entities, repository interfaces, read models, services, controllers, requests, configs, migrations, and one route

Now you can go to the endpoint http://localhost/comments/v1/ and see this message:

{"data":{"message":"Comment - module index"}}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: proprietary
  • 更新时间: 2023-04-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固