ldaidone/laravel-ddd-commands
Composer 安装命令:
composer require ldaidone/laravel-ddd-commands
包简介
A lightweight toolkit that adds Domain-Driven Design scaffolding to any Laravel project. Generate domains, use cases, entities, value objects, repositories, and more with expressive artisan commands — keeping your architecture clean and consistent with zero friction.
README 文档
README
A lightweight toolkit that adds Domain-Driven Design scaffolding to any Laravel project.
Generate domains, use cases, entities, value objects, repositories, events, aggregates, DTOs, actions, and more with expressive artisan commands using the pattern <domain_name>/<element_name> — keeping your architecture clean and consistent with zero friction.
✨ Features
- 🔧 Generate domains, use cases, entities, value objects, repositories, events, aggregates, DTOs, commands, queries, and actions
- ⚡ Works in any Laravel project (no special folder structure required)
- 🧩 Consistent naming convention:
<domain_name>/<element_name>for all generators - 🧩 Fully configurable namespace & path mappings
- 📁 Ships with clean, extensible stub templates for all generators
- 🧱 Encourages modular, maintainable DDD architecture
- 🚀 Zero learning curve — powered entirely through artisan commands
🏗 About the Folder Structure (Important)
As of v0.1.1, the package no longer uses configuration files or dynamic paths.
This is an intentional design choice.
Why?
Because dynamic paths introduce architectural drift. For DDD, structure must be stable, predictable, enforceable, and the same across dev machines, CI runners, and Testbench environments.
The generators now follow a single, consistent convention:
app/
└── Domain/
└── Billing/
├── Entities/
├── ValueObjects/
├── DataTransferObjects/
├── UseCases/
├── Actions/
├── Repositories/
└── Events/
This improves:
- maintainability
- discovery
- onboarding
- large-scale refactors
- automated testing consistency
No config required. No hidden layer. No dynamic directories.
📦 Installation
composer require ldidone/laravel-ddd-commands
Laravel auto-discovers the service provider — no configuration needed.
▶️ Usage
Important: All generators follow the format
<domain_name>/<element_name>, wheredomain_namecorresponds to a domain folder andelement_nameis the name of the element you want to create.
Create a domain
php artisan ddd:create-domain Billing
Create a use case
php artisan ddd:create-use-case Billing/RegisterUser
Create an entity
php artisan ddd:create-entity Billing/User
Create a value object
php artisan ddd:create-value-object Billing/Email
Create a repository
php artisan ddd:create-repository Billing/UserRepository
Create a domain event
php artisan ddd:create-event Billing/UserRegistered
Create an aggregate
php artisan ddd:create-aggregate Billing/Order
Create a DTO (Data Transfer Object)
php artisan ddd:create-dto Billing/UserDto
Create a command
php artisan ddd:create-command Billing/RegisterUser
Create a query
php artisan ddd:create-query Billing/GetUserById
Create an action
php artisan ddd:create-action Billing/SendEmail
List available commands
php artisan list ddd
🧪 Running Tests
composer test
If you're using Pest or PHPUnit, the workflow will handle it automatically.
📊 Test Coverage
If using Codecov:
vendor/bin/phpunit --coverage-clover=coverage.xml
GitHub Actions will upload coverage after each test run.
📚 Roadmap
- Aggregate root generator
- Domain event generator
- DTO generator
- Action generator
- CQRS mode (command/query separation)
- Repository implementation generator (Eloquent/Query Builder)
Support
If this saves you time or helps your project, consider starring ⭐ and consider buying me a coffee! ☕️ — it keeps the ideas flowing!
🤝 Contributing
Pull requests are welcome. Please open an issue first for major changes. Make sure to update tests as needed.
📚 Changelog
See CHANGELOG.md
📄 License
Released under the Apache 2.0 license.
ldaidone/laravel-ddd-commands 适用场景与选型建议
ldaidone/laravel-ddd-commands 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 22 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 11 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「ddd」 「scaffolding」 「artisan」 「domain-driven-design」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ldaidone/laravel-ddd-commands 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ldaidone/laravel-ddd-commands 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ldaidone/laravel-ddd-commands 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Runn Me! Value Objects Library
Build a domain-oriented application on Laravel Framework
Symfony bundle for broadway/broadway.
Provides Symfony param converters for mediagone/types-common package.
DDD auth basic class
Alfabank REST API integration
统计信息
- 总下载量: 22
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 25
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2025-11-23