ericksonreyes/domain-driven-design
54.0
Adequate · 21 September 2026
2.9k
lines of production code
PHP
primary language
4
measurements over time
What this system is
This system is a PHP library implementing Domain-Driven Design (DDD) patterns, providing a structured foundation for building robust applications. It offers a complete set of domain primitives, including value objects for money, addresses, and person identities, alongside interfaces for command and event buses. The library also supports event sourcing and file attachment capabilities for domain entities, all backed by comprehensive automated testing and continuous integration infrastructure.
How it got here
2019 — Initial DDD library scaffolding
13 changes.
This period established the foundational structure of a Domain-Driven Design library, implementing core components such as the Command/Event Bus, value objects, and event-sourced entities. The work included setting up the CI/CD infrastructure and writing comprehensive unit tests to ensure the reliability of these new domain primitives.
2020 — Domain object and exception infrastructure
7 changes.
This period focused on establishing the foundational value objects for Person and Address, along with their corresponding unit tests. The work also introduced a comprehensive set of domain-specific exception classes to handle validation and business rule failures across the domain layer.
Features
Add Person value objects with full-name comparison
The Person value object area now includes new classes for Title, Name, Suffix, and FullName, enabling the construction of a complete person identity. The FullName class aggregates these components and provides a matches() method to compare two full names for equality, as well as a doesNotMatch() method for inequality checks. Corresponding exception classes (e.g., EmptyTitleError, EmptyNameError) are added to handle validation errors.
src/EricksonReyes/DomainDrivenDesign/Common/ValueObject/Person · high confidence
Add domain-specific error classes for common failure scenarios
The codebase introduces a new set of abstract and final exception classes under the DomainDrivenDesign namespace, including AuthenticationFailureError, DeletedRecordError, DomainEventOwnershipError, EmptyIdentifierError, MissingActionPerformerError, MissingEventReplayMethodError, PermissionDeniedError, RecordConflictError, RecordNotFoundError, and TooManyRequestsError. These classes extend standard PHP exceptions (such as InvalidArgumentException, BadMethodCallException, and Exception) to provide domain-expert-friendly error handling for specific business rules and system states.
src/EricksonReyes/DomainDrivenDesign/Common/Exception · high confidence
Add new domain value objects for Money, File, and Phone
Introduced several new value objects to the Domain-Driven Design common library: a Money object that handles currency-typed amounts with comparison and addition capabilities; a File object that manages file metadata, content, and size comparisons; and a PhoneNumber object that validates and stores country, area, and local number components. These additions expand the shared domain primitives available for building domain models.
src/EricksonReyes/DomainDrivenDesign/Common/ValueObject · high confidence
Added CommandBus and EventBus implementations with dedicated exception classes
The application layer now includes a new CommandBus and EventBus, each with their own set of exception classes (DuplicateCommandHandlerError, DuplicateEventHandlerError, MissingHandlerMethodError, UnhandledCommandError). The CommandBus manages command handlers and dispatches commands, while the EventBus registers event handlers and dispatches events, including exception handling for failed event notifications.
src/EricksonReyes/DomainDrivenDesign/Application · high confidence
Added composition-aware validation helpers
The validation namespace now includes a new ClassExtractor utility and a ComposedClass wrapper. ClassExtractor provides static methods to recursively search through object compositions to find or verify the presence of specific class types. ComposedClass wraps an object and exposes has, doesntHave, and extract methods that delegate to the extractor, allowing users to easily check or retrieve nested components within a composed structure.
src/EricksonReyes/DomainDrivenDesign/Common/Validation · high confidence
Added infrastructure interfaces for command/event handling and identity generation
The project now includes a set of new infrastructure interfaces to support domain-driven design patterns. This includes a generic Collection class for managing item sets, and interfaces for a CommandBus and EventBus to handle application commands and domain events respectively. Additional interfaces for event handling (EventHandler, ExceptionHandler), event persistence (EventRepository, EventStore), and identity generation (IdentityGenerator) have been introduced to structure the application's core logic.
src/EricksonReyes/DomainDrivenDesign/Infrastructure · medium confidence
Adds domain entity and event-sourced entity examples
The example directory now includes new domain models: a basic \DomainEntity\ with identity and matching logic, an \EventSourcedDomainEntity\ that handles deletion via an event, and a \FileAttachingDomainEntity\ that incorporates file-attaching capabilities. These classes demonstrate how to implement domain entities and event sourcing patterns within the library.
src/EricksonReyes/DomainDrivenDesign/Example · high confidence
Initial project scaffolding and CI configuration
The repository was initialized with a complete build and testing infrastructure. This includes Phing build scripts (build.xml, build.ci.xml, build.local.xml) for code quality checks (PHPCS, PHPMD, PHPCPD) and unit testing (PhpSpec, PHPUnit). Configuration files for Travis CI (.travis.yml) and Coveralls (.coveralls.yml) were added to automate continuous integration and code coverage reporting. Additionally, a PHP wrapper script (php) and various configuration files (phpcs.xml, phpmd.xml, phpspec.\*.yml, phpunit.xml) were introduced to support the development workflow.
(repo-wide) · high confidence
Introduce Address value object with comparison capabilities
A new Address value object has been added to the domain, composed of Street, City, State, CountryCode, and ZipCode components. Each component enforces non-empty validation via dedicated error classes, and the Address class provides a matches() method to compare two address instances for equality across all fields.
src/EricksonReyes/DomainDrivenDesign/Common/ValueObject/Address · high confidence
New common interfaces for domain objects
Added a set of new interfaces in the Domain-Driven Design common layer to standardize how domain objects expose their properties and behaviors. These include \CanBeValidated\, \CanCompareAmount\, \CanCompareLength\, \CanCompareSize\, \CanDetermineIfEmpty\, \CanMatchString\, \HasAmount\, \HasArrayRepresentation\, \HasComposition\, \HasLength\, and \HasSize\. An abstract base class \SizeableAndMatchableString\ was also introduced to provide default implementations for string comparison and matching logic.
src/EricksonReyes/DomainDrivenDesign/Common/Interfaces · high confidence
New domain interfaces and traits for event sourcing and file attachments
The domain layer now includes new interfaces and traits to support event sourcing and file attachments. The \Event\ interface defines the contract for domain events, while the \AccountableEvent\ interface extends it to track which entity raised an event. A new \Entity\ interface standardizes entity identity and comparison. For event sourcing, the \EventSourcedEntity\ class and its \EventSourcedEntityTrait\ provide methods to store, replay, and check the occurrence of domain events, including validation that an event belongs to the correct entity. Additionally, the \FileAttachingEntity\ class and its \FileAttachingEntityTrait\ enable entities to attach, detach, and retrieve files. A \History\ class extends \Collection\ to record events, and a \Repository\ interface is introduced for entity persistence.
src/EricksonReyes/DomainDrivenDesign/Domain · high confidence
Behavioural changes
Add domain-specific exception classes for value objects
The codebase now includes a set of new exception classes in the \EricksonReyes\\DomainDrivenDesign\\Common\\ValueObject\\Exception\ namespace, each extending \InvalidArgumentException\. These include \EmptyIdentifierError\, \InsufficientMoneyAmountError\, \InvalidCurrencyCodeError\, \InvalidEmailAddressError\, \InvalidMoneyAmountError\, \MismatchedCurrenciesError\, \MissingFileNameError\, \MissingFileTypeError\, \NegativeAreaCodeError\, \NegativeCountryCodeError\, \NegativeExtensionNumberError\, and \NegativePhoneNumberError\. These changes allow the application to throw specific, domain-friendly errors for various validation failures.
src/EricksonReyes/DomainDrivenDesign/Common/ValueObject/Exception · high confidence
Test coverage
Added test coverage for CommandBus and EventBus implementations; Added test coverage for Person value objects; Added tests for the ComposedClass validation logic; Added unit tests for Address value objects; Added unit tests for Domain classes; Added unit tests for domain entities and events; Added unit tests for domain value objects.
Dependencies
Initial composer.json for Domain Driven Design library
The project now includes a composer.json file that defines the PHP 7.2+ requirement and lists development dependencies for testing (PHPUnit, PHPSpec), code coverage, and static analysis tools (PHPCS, PHPMD, etc.).
(dependencies) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 62 → 54 (-7.8)
- Rubric changed (rubric-2026.08.19 → rubric-2026.09.15) — scores are not directly comparable.
Lenses
- Code Health 100 → 100 (+0.0)
- Architecture 100 → 98 (-2.2)
- Maturity 50 → 50 (+0.0)
- Readiness 47 → 31 (-15.8)
- Security 100 → 100 (+0.0)
Resolved (6)
- Coverage not included — suite not readable by the collector
- Dependency hygiene not measured — dependency manifest found but not parsed for hygiene
- No exposed public API
- Test reliability not included
- The README only states 'A collection of Domain Driven Design inspired Classes and Interfaces' without describing what classes or patterns exist in the repository, leaving readers unable to judge whether the project's core features (e.g., command/bus vs value-object structure) are well documented. (README.md)
- single-maintainer — knowledge-concentration (bus factor) risk
New (11)
- Documentation: no installation or build instructions (README.md)
- Documentation: no usage examples (README.md)
- Duplicate interface definition across namespaces. The Application and Infrastructure layers expose identical CommandBus signatures, suggesting a lack of clear separation of concerns or unnecessary duplication of the interface contract.
- Duplicate interface definition across namespaces. The Application and Infrastructure layers expose identical EventBus signatures, mirroring the CommandBus duplication issue.
- Inconsistent method naming within the same class. 'amountIsEqualsTo' compares against an int, while 'isEqualsTo' compares against another Money object. The use of 'EqualsTo' (typo) in both is inconsistent with standard PHP conventions (usually 'isEqualTo') and inconsistent with the 'isLessThan' style used for other comparisons in the same class.
- Inconsistent naming convention for comparison methods. 'CanCompareAmount' uses 'amountIsEqualsTo' (typo), while 'CanCompareLength' and 'CanCompareSize' use 'lengthIsEqualTo' and 'sizeIsEqualTo' (correct). This creates an inconsistent API surface for similar operations.
- Inconsistent naming convention within the Money class. The equality check uses 'isEqualsTo' (typo), while other comparisons use 'isLessThan', 'isGreaterThan', etc. Additionally, the interface 'CanCompareAmount' uses 'amountIs...' prefix, while the class uses 'is...' prefix for object comparison, creating confusion between value comparison and object comparison.
- Namespace inconsistency. The CanCompareSize and HasSize interfaces are prefixed with 'EricksonReyes.EricksonReyes.' while other interfaces in the same package (e.g., CanCompareAmount, CanCompareLength) use 'EricksonReyes.DomainDrivenDesign.Common.Interfaces.'. This suggests a copy-paste error or namespace misconfiguration.
- No ADRs found
- No dependency advisory monitoring
- Typo in method naming. 'amountIsEqualsTo' is grammatically incorrect (should be 'amountIsEqualTo'). This typo is present in both the interface and the concrete implementation, propagating the error.
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
ericksonreyes/domain-driven-design was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 21 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 9fc5893fbf42aac08da54b669920d64e958d591c — the exact code this score is about.
- Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-fa71c66cabd8.