承接 jafar-albadarneh/laravel-ddd 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

jafar-albadarneh/laravel-ddd

Composer 安装命令:

composer require jafar-albadarneh/laravel-ddd

包简介

Scaffold your Laravel services and actions in a Domain-Driven-Design architecture

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

In a Domain-Driven environment, you would want to keep your code as clean and organized as possible. This package allows to create a domain-driven architecture in your Laravel app. The package assumes the following code structure:

- app
    - Domains
        - [DomainA]
            - Actions
            - Events
            - Http
            - Listeners
            - Models
            - Services

By design, each domain should be treated in isolation, where all of the actions and services are scoped to the domain.

In regard to inter-domain communication, you can create a proxy service at the domain level to bridge the communication gap between the domains. Internally you're free to either:

  • Inject and class services directly
  • Follow an internal pub/sub mechanism, where you publish events from (Domain X) and listen to them in other domains [Domain Y, Domain Z ..etc).

Installation

You can install the package via composer:

composer require jafar-albadarneh/laravel-ddd

Usage

The package is equipped with a command line tool that allows you to create a domain-driven architecture in your Laravel app. These command line tools include:

Generating the Domain

After you identify the domain, you can generate it by running the following command:

php artisan make:domain [domain-name]

The command accepts the following options:

  • [domain-name]: The name of the domain you want to create.
  • --with-samples=1: If you want to generate the domain with sample actions and services.

Generating Domain Services

After creating the domain, you can generate the services by running the following command:

php artisan make:service domain=[domain-name]

The command accepts the following options:

  • domain=[domain-name]: The name of the domain you want to generate the services for.
  • --name=[service-name]: If you want to generate a service with a custom name.

Generating Domain Actions

After creating the domain, you can generate the actions by running the following command:

php artisan make:action domain=[domain-name] --name=[action-name]

The command accepts the following options:

  • domain=[domain-name]: The name of the domain you want to generate the actions for.
  • --name=[action-name]: The name of action class within the domain.

Generating Domain DTOs

After creating the domain, settle with your services, you can generate DTOs by running the following command:

php artisan make:dto domain=[domain-name] --name=[dto-name]

The command accepts the following options:

  • domain=[domain-name]: The name of the domain you want to generate the DTO for.
  • --name=[dto-name]: The name of DTO class within the domain.

Generating Domain DTOs

After creating the domain, you can generate DTOs to support data streams among your services and actions by running the following command:

php artisan make:dto domain=[domain-name] --name=[dto-name]

The command accepts the following options:

  • domain=[domain-name]: The name of the domain you want to generate the actions for.
  • --name=[action-name]: The name of DTO class within the domain.

Generating Native Laravel Resources

You won't be getting the full potential of the package if you can't associate native laravel resources (Controllers, Requests, Resources, Middlewares) with your domain. There are two ways to achieve this:

1- Laravel artisan commands already support passing a namespace to any command. So instead of placing all the resources within the App\Http namespace, you can prefix your resource with the FULL domain namespace. For example, if you want to create a controller for the Authentication domain, you can run the following command:

php artisan make:controller \\App\\Domains\\Authentication\\Http\\Controllers\\LoginController

2- [TODO] The package overrides Laravel artisan commands to support passing a domain name to the command. So instead of passing the full namespace of the domain, you can pass a --domain=[domain-name] parameter to your command.

Note: This feature is not yet implemented.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

jafar-albadarneh/laravel-ddd 适用场景与选型建议

jafar-albadarneh/laravel-ddd 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.87k 次下载、GitHub Stars 达 8, 最近一次更新时间为 2022 年 09 月 02 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「laravel」 「jafar-albadarneh」 「laravel-ddd」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 jafar-albadarneh/laravel-ddd 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 jafar-albadarneh/laravel-ddd 我们能提供哪些服务?
定制开发 / 二次开发

基于 jafar-albadarneh/laravel-ddd 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-09-02