fragoe/ddd-business-rules-specification
最新稳定版本:v1.0.2
Composer 安装命令:
composer require fragoe/ddd-business-rules-specification
包简介
Core library implementing the Specification Pattern for DDD business rules with composable boolean operations.
README 文档
README
A lightweight PHP library implementing the Specification Pattern for Domain-Driven Design. Compose business rules with a fluent API using and(), or(), not(), and xor().
Installation
composer require fragoe/ddd-business-rules-specification
Requirements: PHP ^8.3
Usage
Extend CompositeBusinessRule and implement isSatisfiedBy(). Compose rules using the fluent API.
See tests/CompositeBusinessRulesTest.php for comprehensive usage examples including rule creation, composition, and fluent chaining. For a real-world domain example, see tests/CoffeeExamplesTest.php.
Built-in Composites
| Class | Description |
|---|---|
AndBusinessRule |
All rules must be satisfied |
OrBusinessRule |
At least one rule must be satisfied |
XorBusinessRule |
Exactly one rule must be satisfied |
NotBusinessRule |
Inverts the rule result |
Design Philosophy
This library follows strict DDD principles and intentionally excludes infrastructure concerns. Database queries, visualization, and validation framework integration are handled by companion packages:
- ddd-business-rules-doctrine - Doctrine bridge
- ddd-business-rules-analyzer - Static analysis and visualization
Package Ecosystem
| Package | Description |
|---|---|
| fragoe/ddd-business-rules | Meta package |
| fragoe/ddd-business-rules-specification | Core library (this package) |
| fragoe/ddd-business-rules-doctrine | Doctrine bridge |
| fragoe/ddd-business-rules-validation | Validation integration |
| fragoe/ddd-business-rules-analyzer | Analysis tools |
License
MIT - See LICENSE
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-12-22