# carlosas/phpat

✔️ PHP Architecture Tester - Easy architecture testing for PHP

Repository: https://github.com/carlosas/phpat
Canonical: https://ross.abutalabs.com/products/phpat
Homepage: https://phpat.dev
Language: PHP
License: MIT
License Family: permissive
Topics: php, static-analysis, testing, architecture, linter, phpstan-extension
Last push: 2026-08-10T07:02:55+00:00

## Health v2 (maintenance only)
Score: 90/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 97, release rhythm 75, longevity 100
- inputs: {"age_days": 2550, "days_push": 23, "days_rel": 169, "gap_med": 23, "n_releases_24m": 18}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1275, forks 61 (observed 2026-08-28T04:04:12.901672+00:00)

## What it is
PHP Architecture Tester (PHPat) is a PHPStan extension that verifies architectural requirements in PHP codebases, such as which namespaces or classes may depend on which. Rules are written in PHP with a fluent DSL of selectors and assertions, and are executed as part of a standard PHPStan analysis run.

## Use cases
- enforce architecture rules in a php project
- prevent domain layer from depending on infrastructure in php
- verify php layer boundaries with phpstan
- check forbidden dependencies between php namespaces
- assert php classes are final, readonly, or enums
- guard ddd bounded context independence in php
- run architecture conformance tests in ci for php code

## When to choose
- your project already uses PHPStan and you want architecture checks in the same analysis pipeline with baselines and caching
- you need to enforce layer boundaries like domain/application/infrastructure or hexagonal architecture rules
- you prefer writing readable fluent-PHP rules with selectors, regex matching, and because-explanations over config-file-only tools

## When to avoid
- your codebase does not use PHPStan and you are unwilling to adopt it as a dependency
- you need runtime or behavioral testing of code rather than static structural checks
- you require a guaranteed-stable API, since pre-1.0 releases may introduce breaking changes in minor versions

## Facets
- artifact type: plugin
- maturity: active
- function: testing, linter, developer-tools
- domain: testing, developer-tools, backend
- platform: php, cli
- tags: phpstan, phpstan-extension, static-analysis, architecture-testing, architecture-rules, dependency-rules, clean-architecture, ddd, composer, php

## Member repositories
- carlosas/phpat (main) score 90

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:12.901672+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T05:03:00.832152+00:00, confidence not recorded.
  - readme: https://github.com/carlosas/phpat (fetched 2026-08-28T04:04:12.901672+00:00, sha 56c6b215ec7b)
  - homepage: https://phpat.dev (fetched 2026-08-29T12:14:08.623742+00:00, sha b26bce29ec9a)
  - site_page: https://www.phpat.dev/getting-started (fetched 2026-08-29T12:14:08.632820+00:00, sha a902e6172a4a)
  - site_page: https://www.phpat.dev/documentation/rules (fetched 2026-08-29T12:14:08.635599+00:00, sha b7781f0bf200)
  - site_page: https://www.phpat.dev/documentation/selectors (fetched 2026-08-29T12:14:08.638532+00:00, sha 44d0510caba9)
  - site_page: https://www.phpat.dev/documentation/assertions (fetched 2026-08-29T12:14:08.642354+00:00, sha cd7205d8048a)
  - site_page: https://www.phpat.dev/documentation/configuration (fetched 2026-08-29T12:14:08.645172+00:00, sha f57734d1d1df)
  - site_page: https://www.phpat.dev/documentation/other (fetched 2026-08-29T12:14:08.647256+00:00, sha bc2cd64b8b3f)
  - site_page: https://www.phpat.dev/about (fetched 2026-08-29T12:14:08.651459+00:00, sha 484da74cb9b9)
  - site_page: https://www.phpat.dev/CHANGELOG (fetched 2026-08-29T12:14:08.649184+00:00, sha 72fb154626e8)
- Data as of 2026-08-30T08:39:29.467469+00:00.
