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.1.1(2mo ago)024[1 PRs](https://github.com/aseguragonzalez/php-seedwork/pulls)MITPHPPHP ^8.4CI passing

Since Feb 28Pushed 1mo 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 1mo ago

READMEChangelog (3)Dependencies (5)Versions (4)Used By (0)

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

[](#php-seedwork)

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`), uses `EntityId`, raises `DomainEvent` and `DomainException`/ `ValueException`, 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 (and optionally `QueryRepository` for the read side).
- **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.
- **[Best practices](docs/best-practices.md)** — How to use the package in your project.
- **[tests/Fixtures/BankAccount/](tests/Fixtures/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** ^12.5 for tests
- **PHPStan** ^2.1 for static analysis
- **PHP-CS-Fixer** ^3.93 for code style
- **PHP\_CodeSniffer** (PSR-12) for linting

Development
-----------

[](#development)

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

**Debugging:** The PHP debug port in this project is **9000** (not 9003). Configure your IDE or Xdebug client to connect to port 9000 when debugging tests or scripts.

From the root directory of the project (where the `Makefile` is located):

- `make install` — Install pre-commit hooks and Composer dependencies.
- `make all` — Run format-check, lint, static analysis, and tests.
- `make test` — Run PHPUnit (with coverage in `coverage/`).
- `make format` — Fix code style with PHP-CS-Fixer (PSR-12).
- `make format-check` — Check style without changing files.
- `make lint` — Run PHP\_CodeSniffer (PSR-12).
- `make static-analyse` — Run PHPStan (level max).
- `make clean` — Remove vendor, coverage, and caches.
- `make create-package` — Build a zip archive in `dist/`.

Releasing
---------

[](#releasing)

CI checks that `VERSION` and `CHANGELOG.md` are present, well-formed, and in sync (the version in `VERSION` must match the first versioned section in `CHANGELOG.md`). PRs that change `src/` or `composer.json` must also update `VERSION` and/or `CHANGELOG.md`.

1. Edit `VERSION` in this directory with the new semantic version (e.g. `0.1.0`, `0.2.0-alpha`).
2. Commit and push to `main`, or merge a pull request.
3. The CD workflow runs on push to `main`. If the tag `v{VERSION}` does not exist, it runs the CI workflow, which runs checks, builds the package, and creates a GitHub Release with the zip artifact and tag `v{VERSION}`.
4. No manual `git tag` or `git push --tags` is required. When editing CHANGELOG links for new releases, use the tag format `vX.Y.Z` (e.g. `.../releases/tag/v0.1.0`).

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

39

—

LowBetter than 86% of packages

Maintenance88

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 86.7% 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 ~0 days

Total

2

Last Release

80d 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 (13 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")

---

Tags

clean-architectureddd-patternshexagonal-architecturephp

###  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.2k431.1M7.5k](/packages/symfony-dependency-injection)[illuminate/contracts

The Illuminate Contracts package.

705122.9M10.1k](/packages/illuminate-contracts)[illuminate/container

The Illuminate Container package.

31178.1M2.0k](/packages/illuminate-container)[ecotone/ecotone

Supporting you in building DDD, CQRS, Event Sourcing applications with ease.

558549.8k17](/packages/ecotone-ecotone)[civicrm/civicrm-core

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

728272.9k20](/packages/civicrm-civicrm-core)[internal/dload

Downloads binaries.

98142.7k10](/packages/internal-dload)

PHPackages © 2026

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