Skip to content
CAI
Software that uses CAICheck a score

Respect/Validation

63.8

Adequate · 19 September 2026

17.2k

lines of production code

PHP

primary language

1

measurement over time

CAI band scale
CAI lens gauges

What this system is

This system is a PHP validation library that provides a fluent API for checking data types, formats, and business rules. It supports validation for emails, domains, postal codes, and phone numbers, utilizing a container-based architecture for dependency management. The library includes a comprehensive infrastructure for formatting and rendering error messages, along with developer tooling for linting, documentation, and performance benchmarking.

How it got here

2010–2024 — Modernization and test infrastructure overhaul

12 changes.

The project underwent a comprehensive structural and tooling modernization, migrating to PHP 8.5+, Pest, and PHPUnit 12.5 while reorganizing the codebase into a src/ directory. This period focused heavily on expanding test coverage for validation message formatting, exception handling, and transformer logic to ensure robust error reporting and backward compatibility.

2025–2026 — Validation engine refactoring and test expansion

21 changes.

The project underwent a significant architectural overhaul, migrating to a new dependency container, introducing a fluent API via mixin interfaces, and restructuring the validation core for improved performance and short-circuit evaluation. This period also saw the introduction of a comprehensive message formatting system, new CLI tooling for developer workflows, and extensive additions to unit, feature, and benchmark test suites to ensure stability.

Features

Added postal code validation rules for countries

The application now includes a comprehensive dataset of postal code regular expressions for numerous countries in the \data/postal-code.php\ file. This addition enables the system to validate postal code formats against specific country standards, improving the accuracy of address validation for users entering location data.

data · high confidence

Introduce PHP-based CLI console for validation tooling

The repository now includes a new \bin/console\ entry point that replaces previous shell-based tooling with a PHP Symfony Console application. This console exposes a suite of development commands for the Respect/Validation project, including linters for documentation, SPDX headers, and mixin classes, as well as utilities for updating domain suffixes, top-level domains, and postal codes. Users can now run these maintenance and validation tasks directly via the PHP CLI.

bin · high confidence

Introduce new validation transformer infrastructure

The library now includes a new transformer system located in src/Transformers, featuring a Transformer interface, a ValidatorSpec data structure, and a Prefix transformer that modifies validator specifications based on prefix constants. This infrastructure enables the generation of prefix map constants from mixin attributes and integrates with Respect/Fluent and Respect/FluentGen to improve the performance and flexibility of prefix-based validation transformations.

src/Transformers · high confidence

New developer tooling for documentation, SPDX, and mixin linting

The \src-dev\ directory now includes a suite of Symfony Console commands and supporting classes to automate code quality checks. The \lint:docs\ command validates and auto-fixes Markdown documentation files using a new \Markdown\ component (including linters for assertion messages, changelogs, headers, and indexes). The \lint:spdx\ command enforces REUSE compliance by normalizing SPDX headers and tracking contributors via Git blame or log. The \lint:mixin\ command regenerates and validates mixin interfaces and prefix constants from validator attributes. Additionally, \smoke-tests:check-complete\ ensures all validators are covered by smoke tests, while \update:domain-suffixes\, \update:domain-toplevel\, and \update:postal-codes\ automate the fetching and saving of external data lists using a new \DataSaver\ helper.

src-dev · high confidence

New mixin interfaces for validation method chaining

The src/Mixins directory now provides a comprehensive set of PHP interfaces (Builder, Chain, AllBuilder, AllChain, KeyBuilder, KeyChain, LengthBuilder, LengthChain, MaxBuilder, MaxChain, MinBuilder, MinChain, NotBuilder, NotChain) that define the fluent API for the validation library. These interfaces expose static and instance methods for all validation rules (such as email, date, length, and array key validation) and their negations, enabling IDE type narrowing and structured method chaining for both single values and iterables.

src/Mixins · high confidence

New validation message formatting and rendering system

This change introduces a complete new subsystem for formatting and rendering validation error messages. It adds a set of interfaces (ArrayFormatter, StringFormatter, Renderer) and concrete implementations (NestedArrayFormatter, NestedListStringFormatter, FirstResultStringFormatter) that handle how validation results are structured and displayed. The system includes a TemplateRegistry and Template attribute for associating custom error messages with validators, a TemplateResolver for looking up the correct template based on path and scope, and an InterpolationRenderer that uses a translator and placeholder formatter to produce the final output. Additionally, parameter handlers (NameHandler, PathHandler, ResultHandler) are added to correctly format path and name information within error messages.

src/Message · high confidence

Behavioural changes

Added TLD data file for domain validation

A new PHP file (\data/domain/tld.php\) has been added to the codebase, containing a comprehensive list of Top-Level Domains (TLDs) sourced from IANA. This data file supports the domain validation logic, specifically enabling the \UpdateDomainSuffixesCommand\ and the public suffix validator to operate with an up-to-date registry of valid TLDs.

data/domain · high confidence

Repository structure and tooling overhaul

The project has been reorganized to improve developer experience and code quality. The source code directory was renamed from \library/\ to \src/\, and the main entry point class was renamed from \Validator\ to \ValidatorBuilder\, with a global \v\ class alias provided in \aliases.php\ for backward compatibility. The testing framework was upgraded to PHPUnit 10.5, with tests split into \unit\, \feature\, and \inference\ suites, and static analysis (PHPStan) raised to level 8. Documentation is now generated via MkDocs and hosted on Read the Docs, supported by a new \.readthedocs.yaml\ configuration. Additionally, the repository now enforces stricter coding standards via PHPCS and includes REUSE compliance metadata.

(repo-wide) · high confidence

Updated public suffix list data

The public suffix data files in data/domain/public-suffix have been refreshed with new rules and wildcards for numerous country-code and generic top-level domains (including .AC, .AE, .AI, .APP, .AWS, .BR, .CA, .CN, .COM, and many others). This update ensures that domain validation and parsing correctly recognize the latest official public suffixes and their associated service provider subdomains.

data/domain/public-suffix · high confidence

Validation engine refactored to use Respect/Fluent and a new dependency container

The validation core has been rewritten to integrate Respect/Fluent and Respect/Parameter, replacing the legacy NamespacedValidatorFactory with a new FluentValidatorFactory and AutowiringLookup. This change introduces a ContainerRegistry that manages dependencies (including PhoneNumberUtil and UuidFactory) and allows passing custom definitions to the container. Users benefit from improved rule instantiation via the Fluent API, better error handling through new exception classes (ComponentException, InvalidValidatorException), and enhanced result querying capabilities in ResultQuery, including wildcard support for path-based lookups.

src · high confidence

Validator library refactored with new traits, renamed validators, and short-circuit evaluation

The validation library has been restructured to improve performance and consistency. A new \CanEvaluateShortCircuit\ helper trait and \ShortCircuitable\ interface have been introduced, allowing validators like \All\, \AllOf\, and \AnyOf\ to stop processing early when a validation fails. Several validators have been renamed to better reflect their behavior: \Call\ is now \After\, \Callback\ is now \Satisfies\, and \Lazy\ is now \Factory\. The \Attributes\ validator now supports recursive validation for nested object properties, and a new \Trimmed\ validator has been added. Additionally, the codebase has been migrated from \library/\ to \src/\, and various helper traits for comparing values, validating dates, and handling iterables have been standardized.

src/Validators · high confidence

Test coverage

Added Pest-based regression tests for validation error reporting; Added benchmark tests for validation performance; Added static type inference tests for validator mixins; Added test fixtures for data providers and file system scenarios; Added test helper trait for validation message structures; Added test helpers for message formatting and rendering; Added test infrastructure and stub validators for the validation library; Added test stubs for recursive attribute validation and nested structures; Added unit tests for InterpolationRenderer and TemplateRegistry; Added unit tests for Validators namespace; Added unit tests for core validation validators; Added unit tests for exception message formatting; Added unit tests for message formatters and result filters; Added unit tests for the Prefix transformer; Added unit tests for validation core components; Added unit tests for validation helpers and data loading; Added validation message tests for Transformers; Expanded test coverage for validation logic and error reporting; Expanded test coverage for validation message formatting and result querying; Migrate test suite to Pest and add custom assertion helpers; New test infrastructure and expanded validator coverage.

Dependencies

Initial release of Respect/Validation v0.5.0 with PHP 8.5+ support

This entry introduces the initial composer.json and lock files for Respect/Validation version 0.5.0, establishing a new baseline that requires PHP 8.5 or higher. The library now depends on the PSR-11 container interface (psr/container ^2.0) and integrates several Respect ecosystem packages including config, fluent, parameter, string-formatter, and stringifier. It also relies on Symfony polyfills for internationalized domain names and multibyte strings. Development tooling is standardized around PHPUnit 12.5, Pest 4.6, PHPStan 2.0, and various coding standards, while optional features are enabled via suggested packages like egulias/email-validator, giggsey/libphonenumber-for-php-lite, and ramsey/uuid.

(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

Baseline

  • First survey — no prior run to compare against. CAI 64.

Lenses

  • Code Health 99
  • Architecture 99
  • Maturity 55
  • Readiness 65
  • Security 64

Changes since last survey

  • 300 commits — 286 feature/other, 14 fixes

By area

  • (root) — 111 commits
  • tests/feature — 28 commits
  • data/domain — 26 commits
  • library/Rules — 16 commits
  • .github/workflows — 14 commits
  • src/Mixins — 14 commits
  • src/Validators — 14 commits
  • docs/validators — 11 commits
  • library/Message — 11 commits
  • tests/unit — 10 commits
  • library/Mixins — 8 commits
  • docs/rules — 4 commits
  • library/Transformers — 2 commits
  • library/Validators — 2 commits
  • src-dev/Commands — 2 commits
  • src-dev/Markdown — 2 commits
  • src/ContainerRegistry.php — 2 commits
  • tests/src — 2 commits
  • bin/console — 1 commit
  • data/postal-code.php — 1 commit

Notable commits

  • fix: Add regression test for MasterCard ^ anchor
  • fix: Fix PublicSuffix validator and UpdateDomainSuffixesCommand
  • fix: Fix ResultQuery::findByPath() for nested paths
  • fix: Fix SPDX headers in all files
  • fix: Fix deep path chain and root template cascading bugs
  • fix: Fix double validation and state leaks in Attributes recursion
  • fix: Fix factory when validator has no constructor
  • fix: Fix input overwrite not propagating to adjacent results
  • fix: Fix isVisible() initial value bug in NestedListStringFormatter
  • fix: Fix message overriding bug in NestedArrayFormatter
  • fix: Fix misplaced Outer/Inner names when using named() on Each
  • fix: Fix some errors detected by PHPStan
  • fix: Fix wrong links in the list of validators
  • fix: Fixes git workspace after checking out benchmarks
  • change: Abstract common functionality from Min and Max
  • change: Add EachKey validator for validating array keys
  • change: Add FormatterModifier to message rendering and expand test coverage
  • change: Add GitHub action to lint documentation files
  • change: Add Given validator
  • change: Add IDE type narrowing to generated validator mixins
  • …and 280 more

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

Survey your own repository

Respect/Validation 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 19 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 6910d89c13c8a873a68c605e8b5b1b9cd7c33d72 — 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-13a154b7f5d1.