定制 jobins/ddd-command 二次开发

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

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

jobins/ddd-command

Composer 安装命令:

composer require jobins/ddd-command

包简介

Domain Driven Architecture Generator cli for Laravel.

README 文档

README

Introduction

In this architecture we will separate our application and domain layers. In default our application layer lies in 'App\Application' and domain in 'App\Domain' namespace; Further it can be configured from config file.

<?php

return [
    'application'     => 'App\Application',
    'domain'          => 'App\Domain',

    /**
     * |
     * | Base Controller Path
     * |
     */
    'controller_path' => 'App\Infrastructure\Controllers\Controller',
];

Installation

This tool is supposed to require only in the development phase. So you can install it as development dependencies.

composer require jobins/ddd-command --dev
Create a Controller
php artisan ddd:controller LoginController auth

Above Controller class can call from web.php as follows.

<?php

use App\Application\Auth\LoginController;

Route::get('login',[LoginController::class,'index']);
Route::post('login',[LoginController::class,'store']);
Create a FormRequest

Following command creates a Laravel's FomRequest Class in the application domain. i.e. in the app\Application\Auth\Requests\ directory. FormRequest is part of application layer rather than core business layer so it is supposed to be stored in the application directory.

php artisan ddd:request LoginRequest auth

Create a model

Below commands create a Transaction model into the Account domain. The Transaction models lies on app\Domain\Account\Models\Transaction.php file. Domain model is part of core buiness layer so it is supposed to be stored in the domain directory.

php artisan ddd:model Transaction Account

Domain Vs Application

Command Application Domain Description
php artisan ddd:request LoginRequest auth FormRequest Creates FormRequest named LoginRequest in namespace App\Application\Auth\Requests
Yet to implement. Rules
Yet to implement. ResponseClass Have a look on this articles. Versatile Respoonse
php artisan ddd:controller LoginController auth Controllers Creates Controller named LoginController in namespace App\Application\Auth\Controllers
php artisan ddd:model Transaction Account Models
Yet to implement. Jobs
Yet to implement. Actions

统计信息

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

GitHub 信息

  • Stars: 4
  • Watchers: 5
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-03-31

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固