PHPackages                             aseguragonzalez/php-seedwork - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. aseguragonzalez/php-seedwork

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

aseguragonzalez/php-seedwork
============================

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

v0.8.0(1mo ago)096MITPHPPHP ^8.4CI passing

Since Feb 28Pushed 5d agoCompare

[ Source](https://github.com/aseguragonzalez/php-seedwork)[ Packagist](https://packagist.org/packages/aseguragonzalez/php-seedwork)[ RSS](/packages/aseguragonzalez-php-seedwork/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (10)Dependencies (13)Versions (25)Used By (0)

PHP SeedWork
============

[](#php-seedwork)

[![Packagist Version](https://camo.githubusercontent.com/ee00578b5899fb3b13094ba51b1b5cc2c9f30fc3573ec2ea303609fb62f8692c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f61736567757261676f6e7a616c657a2f7068702d73656564776f726b)](https://packagist.org/packages/aseguragonzalez/php-seedwork)[![PHP](https://camo.githubusercontent.com/97ea0149fb2a91e57ee036e7d052d8a9e26fca1719bc353d527adb155c3f0bf3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f61736567757261676f6e7a616c657a2f7068702d73656564776f726b)](https://packagist.org/packages/aseguragonzalez/php-seedwork)[![License: MIT](https://camo.githubusercontent.com/3ece51afe2f316bf3e3e43bd0c65e211326213ed1b9a17f2d26735f9b092f48a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f61736567757261676f6e7a616c657a2f7068702d73656564776f726b)](LICENSE)[![CI](https://github.com/aseguragonzalez/php-seedwork/actions/workflows/ci.yml/badge.svg)](https://github.com/aseguragonzalez/php-seedwork/actions/workflows/ci.yml)[![codecov](https://camo.githubusercontent.com/5050f6e383338d67cb353a87e6adf022019776c432de4c5d8f1c727481e28250/68747470733a2f2f636f6465636f762e696f2f67682f61736567757261676f6e7a616c657a2f7068702d73656564776f726b2f6272616e63682f6d61696e2f67726170682f62616467652e737667)](https://codecov.io/gh/aseguragonzalez/php-seedwork)[![PHPStan](https://camo.githubusercontent.com/3a107a3766189dd1f544b2f871ebf3d6ca1e437e63b3b03c3ca6940753d64283/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6d61782d626c7565)](https://phpstan.org/)[![PHP CS Fixer](https://camo.githubusercontent.com/e4f8d651ef3a5e09e46df97539cfd4839b6ab8d55ecc988cb537a6da8d060731/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7374796c652d5048505f43535f46697865722d627269676874677265656e)](https://cs.symfony.com/)

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

Goal
----

[](#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](docs/) for architecture and usage details.

Architecture role
-----------------

[](#architecture-role)

SeedWork sits between project conventions and application/domain code.

### Layers

[](#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
------------

[](#requirements)

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

Installation
------------

[](#installation)

Install the package with Composer:

```
composer require aseguragonzalez/php-seedwork
```

How to use
----------

[](#how-to-use)

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

- **[Component reference](docs/component-reference.md)** — All interfaces, base classes, and infrastructure components.
- **[Coding standards](docs/coding-standards.md)** — Conventions and do/don't guidelines.
- **[docs/examples/BankAccount/](docs/examples/BankAccount/)** — Full working example (including query handlers and query repository for projections) about how to use the package.

Source and issue tracker: [php-seedwork](https://github.com/aseguragonzalez/php-seedwork).

Built with
----------

[](#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
-----------

[](#development)

If you plan to contribute, please read [CONTRIBUTING.md](.github/CONTRIBUTING.md) and [CODE\_OF\_CONDUCT.md](.github/CODE_OF_CONDUCT.md).

### Dev container

[](#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
```

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

### Make targets

[](#make-targets)

All targets must be run inside the dev container via `devcontainer exec --workspace-folder . make `. 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

[](#documentation-site)

The documentation portal uses [MkDocs Material](https://squidfunk.github.io/mkdocs-material/). Dependencies are installed automatically when the dev container is created.

**Serve locally:**

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

Then open **** 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
---------

[](#releasing)

Releases are fully automated via [semantic-release](https://semantic-release.gitbook.io). 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](https://www.conventionalcommits.org), 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

[](#commit-message-convention)

PrefixEffect`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 releaseThe PR title is also validated against Conventional Commits in CI.

References
----------

[](#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](https://www.amazon.es/Domain-Driven-Design-Tackling-Complexity-Software/dp/0321125215)
- Vaughn Vernon, *Implementing Domain-Driven Design* [2](https://www.amazon.es/Implementing-Domain-Driven-Design-Vaughn-Vernon/dp/0321834577)
- Robert C. Martin, *Clean Architecture: A Craftsman's Guide to Software Structure and Design* [3](https://www.amazon.es/Clean-Architecture-Craftsmans-Software-Structure/dp/0134494164)
- .NET Microservices: Architecture for Containerized .NET Applications [4](https://learn.microsoft.com/en-us/dotnet/architecture/microservices/)
- Architecture Patterns with Python by Harry Percival [5](https://www.oreilly.com/library/view/architecture-patterns-with/9781492052197/)

License
-------

[](#license)

[MIT License](LICENSE). Copyright (c) 2026 Alfonso Segura.

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance96

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 58.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~10 days

Recently: every ~2 days

Total

9

Last Release

40d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f90a221c139c04cded0d8056aa619c2849de13cadd505c4f5f6b74a580be87fc?d=identicon)[Alfonso Segura](/maintainers/Alfonso%20Segura)

---

Top Contributors

[![aseguragonzalez](https://avatars.githubusercontent.com/u/2671340?v=4)](https://github.com/aseguragonzalez "aseguragonzalez (30 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (14 commits)")[![semantic-release-bot](https://avatars.githubusercontent.com/u/32174276?v=4)](https://github.com/semantic-release-bot "semantic-release-bot (7 commits)")

---

Tags

clean-architecturedddddd-patternshexagonal-architecturephpseedwork

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/aseguragonzalez-php-seedwork/health.svg)

```
[![Health](https://phpackages.com/badges/aseguragonzalez-php-seedwork/health.svg)](https://phpackages.com/packages/aseguragonzalez-php-seedwork)
```

###  Alternatives

[symfony/dependency-injection

Allows you to standardize and centralize the way objects are constructed in your application

4.2k455.6M9.6k](/packages/symfony-dependency-injection)[illuminate/contracts

The Illuminate Contracts package.

706130.3M13.3k](/packages/illuminate-contracts)[illuminate/container

The Illuminate Container package.

31182.0M2.4k](/packages/illuminate-container)[ecotone/ecotone

Enterprise architecture layer for Laravel and Symfony — CQRS, Event Sourcing, Durable Workflows (Sagas, Orchestrators), Projections, and Outbox messaging via PHP attributes.

564576.7k53](/packages/ecotone-ecotone)[symfony/type-info

Extracts PHP types information.

20069.8M270](/packages/symfony-type-info)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751291.4k43](/packages/civicrm-civicrm-core)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
