domain-engine/library 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

domain-engine/library

Composer 安装命令:

composer require domain-engine/library

包简介

A framework agnostic structure providing domain concepts specifications

README 文档

README

License: MIT PHP Version

A lightweight PHP library providing essential building blocks for Domain-Driven Design (DDD) applications.

Features

  • Value Objects: Base implementation for immutable value objects
  • Domain Events: Foundation for domain event handling
  • Aggregate Root: Base class for aggregate roots in domain models
  • Commands: Base command pattern implementation
  • Process manager: in development
  • Query: in development
  • Read model: in development

Requirements

  • PHP 8.2 or higher
  • Composer

Installation

composer require domain-engine/library

Usage

Value Objects

use DomainEngine\Library\Value\StringValue;

class Email extends StringValue
{
    protected static function from(string $value): self
    {
        if (!filter_var($value, FILTER_VALIDATE_EMAIL)) {
            throw new \InvalidArgumentException("Invalid email address");
        }
    }
}

Domain Events

use DomainEngine\Library\Domain\DomainEvent;

class UserRegistered extends DomainEvent
{
    public function __construct(
        private string $userId,
        private string $email
    ) {
    }
}

Commands

use DomainEngine\Library\Application\Command;

class RegisterUserCommand extends Command
{
    public function __construct(
        public readonly string $email,
        public readonly string $password
    ) {}
}

Contributing

Contributions are welcome! Please feel free to submit a Pull Request, feedback or Idea.

License

This project is licensed under the MIT License - see the LICENSE file for details.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-11-14