Skip to content
CAI
Software that uses CAICheck a score

burzum/cakephp-service-layer

64.2

Adequate · 22 September 2026

1.7k

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 CakePHP 5 plugin that implements a service-oriented architecture, providing a structured way to organize business logic into distinct service and domain model layers. It automates the generation of service classes and their associated PHPDoc annotations to support IDE autocomplete and static analysis. The framework also handles pagination and service location, ensuring compatibility with modern CakePHP APIs while maintaining backward compatibility for existing plugins.

How it got here

2018 — CakePHP 5 migration and test infrastructure

12 changes.

The project was upgraded from CakePHP 3.5 to 5.0, requiring significant refactoring of the service layer to align with the new paging API and modern PHP standards. Concurrently, comprehensive test infrastructure was established, including PHPUnit configurations, domain model locators, and extensive unit tests for the service and pagination components.

2019–2020 — Service layer implementation

6 changes.

This period focused on implementing a new service layer architecture, including the creation of a bake command and associated templates for generating service classes. To support this, automatic PHPDoc annotations were added to improve IDE and static analysis tooling, while comprehensive unit tests were introduced to validate the new components.

Features

Add template for generating service classes

A new Twig template for generating service classes has been added to the bake directory. This template provides the structure for creating PHP service classes with strict types and a defined namespace, enabling the bake tool to scaffold new service files.

templates · high confidence

Added DomainModelAwareTrait and DomainModelLocator for service layer integration

The DomainModel directory now includes a new DomainModelAwareTrait and DomainModelLocator class. The trait provides a loadService method that uses a CakePHP ObjectRegistry-based locator to instantiate domain model classes, supporting optional property assignment and constructor arguments. The locator resolves class names via CakePHP's App::className and throws a RuntimeException if a domain model is not found. This introduces a new way to access domain models within the service layer.

src/DomainModel · high confidence

Added ServiceTask for IDE autocomplete support

A new ServiceTask class has been introduced in the Generator component to enable IDE autocomplete for service classes. This task scans the Service namespace and loaded plugins to map service names to their corresponding class names, which are then used to generate Override directives for better static analysis and IDE support.

src/Generator · high confidence

Added service layer bake command and renamed plugin class

A new \bake service\ command has been added to generate service layer components, implemented via the new \BakeServiceCommand\ class. The plugin's main entry point has been renamed from \Plugin\ to \ServiceLayerPlugin\, with the old \Plugin\ class retained as a deprecated alias for backward compatibility.

src · high confidence

Automatic PHPDoc annotations for services in ServiceAware classes

A new \ServiceAwareClassAnnotatorTask\ was added to automatically generate \@property\ PHPDoc annotations for services loaded via \loadService()\ calls. This ensures IDEs and static analysis tools can correctly identify the types of services injected into classes that use \ServiceAwareTrait\.

src/Annotator · high confidence

Initial project scaffolding and tooling configuration

The repository is initialized with essential configuration files to standardize the development environment and CI/CD pipeline. This includes an .editorconfig for consistent coding style, a .gitattributes for file handling, and a .gitignore to exclude build artifacts. Additionally, the project introduces static analysis and testing tooling: a phpstan.neon file configures PHPStan at level 8 for high-level static analysis, a phpunit.xml.dist file sets up the PHPUnit test suite, and a phpcs.xml file enforces CakePHP coding standards. The old readme.md is removed in favor of a comprehensive README.md that documents the plugin's purpose, usage, and licensing.

(repo-wide) · high confidence

Behavioural changes

Automatic pagination parameter injection into requests

A new bootstrap configuration in config/bootstrap.php registers a listener on the Controller.initialize event. This listener attaches a closure to each controller's event manager to listen for the 'Service.afterPaginate' event, which automatically updates the current request with pagination parameters via the addPagingParamToRequest method.

config · high confidence

Updated pagination handling and service loading to align with CakePHP 5

The service layer now uses CakePHP 5's new paging API, replacing the deprecated \Cake\\Datasource\\Paginator\ with \Cake\\Datasource\\Paging\\NumericPaginator\ and \PaginatorInterface\. The \ServicePaginatorTrait\ has been updated to pass pagination settings to the paginator and handle event stopping, while the \ServiceLocator\ and \ServiceAwareTrait\ have been updated to support nested service loading and optional property assignment, ensuring compatibility with the latest CakePHP framework changes.

src/Service · medium confidence

Test coverage

Added test application model for Articles; Added test coverage for ServiceAwareClassAnnotatorTask; Added test fixture for MyController; Added test infrastructure for the CakePHP integration; Added test service classes for the test application; Added tests for DomainModelLocator; Added unit tests for ServiceLocator and ServicePaginatorTrait; Added unit tests for ServiceTask generator; Updated test suite for the DomainModel layer.

Dependencies

Upgrade to CakePHP 5 and modernize project configuration

The project has been upgraded from CakePHP 3.5 to CakePHP 5.0, requiring a PHP version bump to 8.1. This update includes significant changes to the \composer.json\ file, such as adding a \cakephp-plugin\ type, updating the \require\ section to specify \cakephp/cakephp: ^5.0.0\, and adding development dependencies like PHPUnit 10.2, PHPStan, and PHP\_CodeSniffer. The \composer.lock\ file was removed, indicating a shift in how dependencies are managed or locked. These changes affect the underlying framework and tooling used by the application.

(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

This is the PUBLIC form of this artifact. Findings are listed in full, but the details of SECURITY findings — which rule fired, in which file, on which line, and how to fix it — are deliberately withheld, and any secret-scanner results are excluded entirely. Where detail is absent here it was REMOVED FOR PUBLICATION; it is not missing from the analysis. The complete artifact is available from the repository owner.

Score

  • CAI 62 → 64 (+2.3)
  • Rubric changed (rubric-2026.08.19 → rubric-2026.09.15) — scores are not directly comparable.

Lenses

  • Code Health 84 → 91 (+6.4)
  • Architecture 100 → 100 (-0.5)
  • Maturity 51 → 50 (-1.4)
  • Readiness 68 → 60 (-7.3)
  • Security 65 → 95 (+30.4)

Resolved (13)

  • Coverage not included — suite not readable by the collector
  • Dependency hygiene not measured — dependency manifest found but not parsed for hygiene
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • No exposed public API
  • Test reliability not included
  • The refactoring example moves the Jobs->getListForUser() call into a service, but it does not show how to register the new service class with the DI container so consumers can resolve it. (docs/Example.md)
  • dormant codebase — no living knowledge left to concentrate

New (17)

  • Dependency hygiene PARTLY measured — Composer dependencies read, no committed lock to grade for currency
  • Documentation: no installation or build instructions (README.md)
  • Documentation: no usage examples (README.md)
  • Duplicated block (14 lines × 2) (src/DomainModel/DomainModelLocator.php)
  • Duplicated block (6 lines × 2) (src/DomainModel/DomainModelAwareTrait.php)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • Medium: security finding (details withheld)
  • Medium: security finding (details withheld)
  • Medium: security finding (details withheld)
  • No dependency advisory monitoring
  • Workflow token permissions not restricted

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

Survey your own repository

burzum/cakephp-service-layer 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 96568a528a8bd4c409bf904a5249640206eb8b17 — 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.