aseguragonzalez/php-seedwork 问题修复 & 功能扩展

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

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

aseguragonzalez/php-seedwork

Composer 安装命令:

composer require aseguragonzalez/php-seedwork

包简介

DDD and Hexagonal (Clean) Architecture building blocks (aggregates, entities, value objects, etc).

README 文档

README

Packagist Version PHP License: MIT CI codecov PHPStan PHP CS Fixer

DDD and Hexagonal (Clean) Architecture building blocks (aggregates, entities, value objects, command/query handlers, etc).

Goal

  • Unify patterns: All domain and application code extends or implements SeedWork abstractions, keeping the codebase consistent and predictable.
  • Keep the domain pure: Domain types depend only on SeedWork domain types; no framework or infrastructure in the domain layer.
  • Clear boundaries: Application use cases are expressed as command handlers (writes) and query handlers (reads), with primitives-only DTOs at the port boundary.

See the docs for architecture and usage details.

Architecture role

SeedWork sits between project conventions and application/domain code.

Layers

  • Domain layer: Extends SeedWork domain bases (AggregateRoot, Entity, ValueObject), raises DomainEvent, throws \DomainException (PHP stdlib) for domain failures, and defines repository interfaces extending Repository.
  • Application layer: Use case interfaces extend CommandHandler or QueryHandler and implement handle(). Handlers implement those interfaces and depend on domain repository interfaces.
  • Infrastructure layer: Implements Repository and optionally DomainEventBus (e.g. DeferredDomainEventBus). Controllers dispatch to use cases; middleware or similar calls DomainEventBus::publish() after handling a request.

Requirements

  • PHP 8.4 or later
  • Composer 2.x
  • Docker and Dev Container for development

Installation

Install the package with Composer:

composer require aseguragonzalez/php-seedwork

How to use

After installation, the library is available under the SeedWork\ namespace.

Source and issue tracker: php-seedwork.

Built with

  • PHP 8.4
  • Composer for dependency management
  • PHPUnit for tests
  • PHPStan level max for static analysis
  • PHP-CS-Fixer for code style (@PhpCsFixer ruleset)

Development

If you plan to contribute, please read CONTRIBUTING.md and CODE_OF_CONDUCT.md.

Dev container

All tooling (PHP, Composer, PHPStan, PHP-CS-Fixer, pre-commit) runs inside the dev container. Start it once from the project root:

devcontainer up --workspace-folder .

Then run any make target with:

devcontainer exec --workspace-folder . make <target>

Debugging: Xdebug listens on the default port 9003. Configure your IDE or Xdebug client accordingly.

Make targets

All targets must be run inside the dev container via devcontainer exec --workspace-folder . make <target>. Running them directly on the host will fail because the required tools (PHP, Composer, etc.) are only available inside the container.

  • make all — Install deps, fix code style, and run the full check pipeline.
  • make check — Layer boundary check + code style + static analysis + tests (no coverage). Run before every commit.
  • make install — Install Composer dependencies.
  • make cs — Check code style with PHP-CS-Fixer (dry-run).
  • make cs-fix — Fix code style with PHP-CS-Fixer.
  • make stan — Run PHPStan (level max).
  • make test — Run PHPUnit with coverage report in coverage/html/.
  • make test-no-coverage — Run PHPUnit without coverage (faster).
  • make test-examples — Run the BankAccount example test suite.
  • make clean — Remove vendor, coverage, and caches.
  • make create-package — Build a zip archive in dist/.
  • make docs-serve — Serve the documentation site locally on port 8001.

Documentation site

The documentation portal uses MkDocs Material. Dependencies are installed automatically when the dev container is created.

Serve locally:

devcontainer exec --workspace-folder . make docs-serve

Then open http://localhost:8001/php-seedwork/ in your browser. The dev container forwards port 8001 automatically; if you use VS Code with the Dev Containers extension the browser opens on its own.

The server watches for file changes and reloads the browser automatically. Press Ctrl+C to stop it.

Releasing

Releases are fully automated via semantic-release. No manual version bumps or CHANGELOG edits are needed.

  • Automatic: Merging to main triggers the publish.yml workflow. semantic-release analyses the commits since the last release, computes the next version following Conventional Commits, updates CHANGELOG.md, creates a git tag, and publishes a GitHub Release.
  • Pre-release: Trigger the prerelease.yml workflow manually (workflow dispatch) with a preid like pr-42 or beta. This creates a tagged pre-release without touching main.

Commit message convention

Prefix Effect
fix: Patch release (0.0.x)
feat: Minor release (0.x.0)
feat!: or BREAKING CHANGE: Major release (x.0.0)
chore:, docs:, test: No release

The PR title is also validated against Conventional Commits in CI.

References

This package draws on the following literature and on the experience of building solid, scalable, and maintainable systems in different stacks (PHP, C#, Python, TypeScript).

  • Eric Evans, Domain-Driven Design: Tackling Complexity in the Heart of Software 1
  • Vaughn Vernon, Implementing Domain-Driven Design 2
  • Robert C. Martin, Clean Architecture: A Craftsman's Guide to Software Structure and Design 3
  • .NET Microservices: Architecture for Containerized .NET Applications 4
  • Architecture Patterns with Python by Harry Percival 5

License

MIT License. Copyright (c) 2026 Alfonso Segura.

aseguragonzalez/php-seedwork 适用场景与选型建议

aseguragonzalez/php-seedwork 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 92 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 02 月 24 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 aseguragonzalez/php-seedwork 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-24