Skip to content
CAI
Software that uses CAICheck a score

ug-libraries/clean-architecture-core-php

70.3

Strong · 9 November 2026

984

lines of production code

PHP

primary language

7

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is a PHP-based application framework that manages HTTP requests and business use cases through immutable, dependency-injected components. It enforces structured error handling via a standardized exception formatting contract and provides a streamlined API for creating and accessing request data. The architecture emphasizes immutability and explicit field access, ensuring consistent data flow from request to response presentation.

Behavioural changes

Exception formatting interface expanded with status code and message accessors

The ExceptionFormatter trait now requires implementers to provide status code and message accessors (getCode and getMessage), changing the contract for exception formatting. This ensures that all exceptions processed by the formatter expose their HTTP status code and message, allowing for more structured error responses.

src/Exception · medium confidence

Refactor Usecase to use immutable request handling and add field accessors

The Usecase class now requires non-null RequestInterface and PresenterInterface dependencies, replacing the previous nullable builder pattern with immutable setter methods (withRequest/withPresenter). A new getField method allows retrieving individual request fields with an optional default, and a getRequestId accessor is added. The Response class now accepts a default value for the get method, and the Presenter's getResponse/getFormattedResponse methods are removed.

src/Usecase · medium confidence

Simplified request handling with direct property access

The request handling mechanism has been refactored to remove the intermediate \RequestBuilder\ and \RequestParam\ classes, replacing them with a direct payload-to-object transformation. The \Request\ class now uses a \PropertyAccessor\ trait to allow individual field access via magic methods (\\_\get\/\\\_set\) and a \get\ method, while \createFromPayload\ returns the request instance itself rather than a builder. This change streamlines the API for creating and accessing application request data.

(repo-wide), src/Request · high confidence

Test coverage

Updated test suite for request and usecase components

Added a new test file for the CustomPresenter and updated existing tests for CustomRequest and Usecase. The request tests now verify that request creation returns the RequestInterface rather than RequestBuilderInterface, and validate that field constraints are properly wrapped in BadRequestContentException. The usecase tests were updated to use the new withRequest/withPresenter fluent API methods and assert that the presenter's getResponse() method returns the correct data structure.

tests · high confidence

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 70 → 70 (+0.1)
  • Rubric changed (rubric-2026.10.5 → rubric-2026.11.2) — scores are not directly comparable.

Lenses

  • Code Health 100 → 100 (+0.0)
  • Architecture 69 → 69 (+0.0)
  • Maturity 65 → 65 (+0.0)
  • Readiness 67 → 67 (+0.0)
  • Security 96 → 98 (+1.8)

Resolved (4)

  • Ambiguous naming for error message retrieval. 'getDetailsMessage' in the Exception class suggests a specific type of message (details), while 'getMessage' in the formatter is generic. It is unclear if these return the same data or if 'DetailsMessage' is a subset.
  • Documentation: no project overview (Readme.md)
  • Inconsistent method signature for property access. RequestInterface accepts a default value argument, while ResponseInterface does not, despite both being used for data retrieval.
  • Redundant definition of 'format' method. The interface defines format(), and the trait implementing it also defines format(). While technically valid in PHP, it creates confusion about whether the interface contract or the trait implementation is the source of truth, especially if other classes implement the interface without the trait.

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

ug-libraries/clean-architecture-core-php 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 9 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit cbb28b2bfbab67da4402b42554043e6486589409 — the exact code this score is about.
  • Scored under rubric-2026.11.2 — the same rubric and the same method as every other entry in this index.
  • Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.3+preprod-bb0cb800cd0f.