damianopetrungaro/clean-architecture
57.0
Adequate · 22 September 2026
3.3k
lines of production code
PHP
primary language
7
measurements over time
What this system is
This system is a PHP-based clean architecture framework designed to structure applications with distinct layers for domain logic, data mapping, and persistence. It provides reusable components for managing immutable collections, type-safe enumerations, and structured error handling. The framework also includes a Slim example application that demonstrates user management use cases, dependency injection, and standardized API responses.
Features
Add slim example with user management and database migrations
The slim example now includes a complete setup for user management, featuring a database migration to create a users table and a container configuration that registers use cases for listing, getting, adding, updating, and deleting users. The example also provides environment configuration for database connections and logging, along with routing for user-related endpoints.
examples · high confidence
Added CloneArrayTrait for deep array cloning
A new trait, CloneArrayTrait, was added to the common library. It provides a protected cloneArray method that performs a deep clone of an array, handling nested arrays and objects by recursively cloning them. This allows other classes to easily create deep copies of complex array structures.
src/Common/CommonTrait · high confidence
Added Enum base class and interface for type-safe constant management
Introduced a new \Enum\ interface and a \ReflectionEnum\ abstract class in the \src/Common/Enum\ directory. The \ReflectionEnum\ class provides a base implementation that validates constructor values against class constants, allowing developers to create type-safe enumerations. The implementation includes methods to retrieve allowed values, compare enum instances for equality, and convert the enum to a string representation.
src/Common/Enum · high confidence
Introduce Request interface and CollectionRequest implementation
Added a new Request interface and its CollectionRequest implementation in the UseCase/Request directory. The interface defines methods for retrieving, adding, and removing data, while the implementation wraps a Collection object to provide these operations.
src/UseCase/Request · high confidence
Introduce core domain interfaces for mapping, persistence, and use cases
Added new interface definitions to the codebase: a \Mapper\ interface for transforming objects to and from arrays, a \Transaction\ interface defining begin, commit, and rollback operations for database transactions, and a \UseCase\ interface for executing use cases with request and response objects. These interfaces establish the contracts for data transformation, transactional persistence, and business logic execution within the clean architecture layers.
src/Mapper, src/Persistence, src/UseCase · high confidence
Introduced abstract error base class and error interfaces
The error handling structure in the UseCase layer has been refactored to support a more structured error model. A new \Error\ interface defines the contract for error objects, while an \AbstractError\ base class provides a concrete implementation storing error code and type. Additionally, an \ErrorType\ interface and an \AbstractErrorType\ abstract class are introduced to categorize errors, extending a \ReflectionEnum\ base. This change standardizes how errors are represented and typed within the application's use cases.
src/UseCase/Error · high confidence
Introduces an immutable Collection interface and ArrayCollection implementation
A new \Collection\ interface and \ArrayCollection\ implementation have been added to the \src/Common/Collection\ directory. The \Collection\ interface defines methods for managing a set of items, including \all()\, \clear()\, \contains()\, \get()\, \has()\, \keys()\, \length()\, \mergeWith()\, \with()\, \without()\, and \values()\. The \ArrayCollection\ class implements this interface, providing an immutable-style collection where mutating methods like \with()\ and \without()\ return new cloned instances rather than modifying the original object. This allows for safer data handling by preventing unintended side effects from shared references.
src/Common/Collection · high confidence
Introduces structured response and validation interfaces
Adds a new \Response\ interface and \CollectionResponse\ implementation that manage data and error collections with dedicated \add\ and \replace\ methods, alongside status checks. Simultaneously introduces \ValidableRequest\ and \ValidableUseCase\ interfaces to standardize validation logic across the application.
src/UseCase/Response · high confidence
Behavioural changes
Refactored the Slim example with a clean architecture structure
The Slim example has been refactored to follow a clean architecture pattern, introducing a new \Container\ for dependency injection, a \SlimResponseBuilder\ for standardized JSON:API-style error and success responses, and dedicated controllers for each user use case (Add, Get, List, Update, Delete). The change also adds domain entities, value objects, and repository interfaces to separate the application logic from the framework-specific implementation.
examples/slim · medium confidence
Test coverage
Added test fixture for Enum class; Added unit tests for UseCase components; Added unit tests for the Collection component; Added unit tests for the Enum class.
Dependencies
Initial project setup with PHP and Slim framework dependencies
The repository was initialized with two Composer manifest files that define the project's PHP version requirements and third-party dependencies. The root composer.json sets a minimum PHP version of 7.1 and includes PHPUnit and a test reporter for development. The examples/slim/composer.json introduces dependencies for a Slim 3.x application, including Doctrine DBAL, Ramsey UUID, Monolog, and the project's own clean-architecture package (version 0.3).
(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 → 57 (-5.0)
- Rubric changed (rubric-2026.08.19 → rubric-2026.09.15) — scores are not directly comparable.
Lenses
- Code Health 99 → 99 (-0.5)
- Architecture 100 → 97 (-2.6)
- Maturity 49 → 49 (+0.0)
- Readiness 50 → 39 (-10.8)
- Security 95 → 95 (+0.0)
Resolved (9)
- Coverage not included — suite not readable by the collector
- Dependency hygiene not measured — dependency manifest found but not parsed for hygiene
- Duplicated block (12 lines × 2) (examples/slim/src/Users/Domain/UseCase/AddUserUseCase.php)
- Duplicated block (7 lines × 2) (examples/slim/src/Users/Application/Repository/DBALUserRepository.php)
- Duplicated block (9 lines × 2) (examples/slim/src/Users/Domain/UseCase/AddUserUseCase.php)
- Duplicated block (9 lines × 3) (examples/slim/src/Users/Application/Controller/AddUserController.php)
- No exposed public API
- Test reliability not included
- dormant codebase — no living knowledge left to concentrate
New (18)
- Documentation: no installation or build instructions (README.md)
- Documentation: no usage examples (README.md)
- Duplicated block (12 lines × 3) (examples/slim/src/Users/Application/Controller/AddUserController.php)
- Duplicated block (13 lines × 2) (examples/slim/src/Users/Application/Repository/DBALUserRepository.php)
- Duplicated block (13 lines × 2) (examples/slim/src/Users/Domain/UseCase/AddUserUseCase.php)
- Duplicated block (23 lines × 2) (examples/slim/src/Users/Domain/UseCase/AddUserUseCase.php)
- Duplicated block (7 lines × 2) (examples/slim/src/Users/Domain/ValueObjects/Name.php)
- Duplicated block (8 lines × 2) (examples/slim/src/Users/Domain/UseCase/AddUserUseCase.php)
- Duplicated block (8 lines × 2) (examples/slim/src/Users/Domain/UseCase/DeleteUserUseCase.php)
- No assertions: testAddDataMethod (tests/Unit/UseCase/Response/ResponseTest.php)
- No assertions: testAddErrorMethod (tests/Unit/UseCase/Response/ResponseTest.php)
- No assertions: testRemoveDataAndErrorMethod (tests/Unit/UseCase/Response/ResponseTest.php)
- No assertions: testReplaceDataMethod (tests/Unit/UseCase/Response/ResponseTest.php)
- No assertions: testReplaceErrorMethod (tests/Unit/UseCase/Response/ResponseTest.php)
- No dependency advisory monitoring
- TodoComment (examples/slim/src/Common/Response/SlimResponseBuilder.php)
- TodoComment (tests/Unit/UseCase/Response/ResponseTest.php)
- TodoComment (tests/Unit/UseCase/Response/ResponseTest.php)
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
damianopetrungaro/clean-architecture 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 22 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 d0c91ec04f37d33b5ce4456b64a071e0e1cd5048 — 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-821afab8930d.