承接 complex-heart/contracts 相关项目开发

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

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

complex-heart/contracts

Composer 安装命令:

composer require complex-heart/contracts

包简介

Common interfaces for PHP Complex Heart SDK.

README 文档

README

Test

Common interfaces for PHP Complex Heart SDK.

Domain Layer

Model

Core building blocks for domain-driven design:

  • Aggregate - Root entity with domain event publishing
  • Entity - Domain object with unique identity
  • ValueObject - Immutable domain value with equality
  • Identifier - Unique identifier representation

Events

Domain event interfaces following ISP (Interface Segregation Principle):

  • Event - Base domain event (eventId, eventName, payload, occurredOn)
  • Traceable - Distributed tracing (correlationId, causationId)
  • Sourceable - Event sourcing (aggregateId, aggregateType, eventVersion)
  • EventBus - Publishes domain events

Application Layer

Command

Write operations (CQRS):

  • Command - Marker interface for state-changing operations
  • CommandBus - Dispatches commands to handlers
  • CommandHandler - Executes commands

Query

Read operations (CQRS):

  • Query - Marker interface for data retrieval
  • QueryResponse - Marker interface for query results
  • QueryBus - Routes queries to handlers
  • QueryHandler - Executes queries and returns responses

Handler

Event handlers:

  • EventHandler - Reacts to domain events

Service Bus

Unified message bus facade:

  • ServiceBus - Provides access to CommandBus, QueryBus, and EventBus

Architecture

This library follows Clean Architecture principles with explicit layer separation:

  • Domain → Application - Domain layer is independent, Application depends on Domain
  • Layer-Explicit Namespaces - Clear architectural boundaries in namespace structure
  • Interface Segregation - Compose only needed capabilities (e.g., Event + Traceable + Sourceable)

Architecture Testing

The project includes automated architecture tests using Pest PHP:

composer test

Tests enforce:

  • Domain layer independence (no Application dependencies)
  • Correct interface placement and usage
  • Clean Architecture dependency rules
  • PHP and security best practices (via arch presets)

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2021-05-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固