ArchUnitPHP

Architecture testing for PHP. The PHP foundation focuses on static source analysis, honest Composer autoload resolution, lazy immutable rules, and structured violations. It is designed to integrate with PHPUnit and Pest without coupling the core to either.

Foundation stagePHP ecosystemTo be finalized

Roadmap

Follow the public foundation backlog
ArchitectureTest.php
$rule = ArchUnit::projectFiles()
    ->inFolder('src/Api/**')
    ->shouldNot()
    ->dependOnFiles()
    ->inFolder('src/Infrastructure/**');

ArchAssert::passes($rule);

The ecosystem

PHP, in context.

PHP is a dynamic language built for the web and deployed across everything from small sites to major commerce platforms. Modern PHP adds strong typing features, Composer manages packages and autoloading, and frameworks such as Laravel and Symfony give large applications a clear structure to protect.

01

Web applications, APIs, commerce, and content platforms

02

Composer, Laravel, Symfony, PHPUnit, and Pest

03

Planned static analysis without loading the application

Adoption snapshot

Public adoption, in context.

Packagist publishes download statistics for Composer packages, but the ArchUnitPHP README currently describes a delivery skeleton with no package to install.

Package status
No Composer package published
Public totals after publication
Reported history
Unavailable
No package published
Latest 30 days
Unavailable
No package published
GitHub stars
0
Snapshot of October 4, 2026

Capabilities

What ArchUnitPHP brings to the test suite.

The family shares a recognizable architecture vocabulary while each implementation stays honest about its language, toolchain, and maturity.

01

Static analysis without loading the application

02

Composer autoloading and symbol resolution

03

Lazy and immutable rule builders

04

PHPUnit and Pest integration targets

05

Structured violations

06

Pure graph and end-to-end test boundaries

Go deeper

Start with Composer-aware boundaries.

The target API resolves namespaces through Composer before it evaluates dependency rules. This example is illustrative while the public foundation work is still underway.

DomainBoundaryTest.php
$rule = ArchUnit::projectFiles()
    ->inFolder('src/Domain/**')
    ->shouldNot()
    ->dependOnFiles()
    ->inFolder('src/Http/**');

ArchAssert::passes($rule);

Documentation highlights

Work with ArchUnitPHP beyond the quickstart.

ArchUnitPHP is a delivery skeleton with an explicit design direction. It is not presented as a released package, and the current documentation separates intended behavior from shipped behavior.

01

Resolve PHP without booting the app

The planned extraction layer will read PHP source and Composer autoloading information without loading or executing application code.

  • Namespaces, use declarations, includes, and symbol dependencies need source-backed resolution.
  • Composer source roots and package boundaries must remain visible rather than being inferred from conventions alone.
  • Dynamic runtime behavior will require explicit limits instead of guessed graph edges.
02

Keep rules portable and PHP-native

The target grammar mirrors the family while preserving PHP method chaining and ecosystem conventions.

  • Lazy, immutable builders will describe the rule before project analysis begins.
  • Structured violations keep the core independent from PHPUnit and Pest.
  • Pure graph algorithms can be tested apart from real-project extraction.
03

Make maturity impossible to misread

The repository currently tracks foundation work only, so examples describe direction rather than a Composer package users can install.

  • There is no published package or supported PHP matrix yet.
  • The issue backlog owns API and delivery decisions.
  • The planned status remains visible alongside every call to action.
Read the complete documentation ↗

Current maturity

Foundation stage

A public delivery skeleton and design target, not a Composer package or released API yet.

LanguagePHP
ReleasePlanned
RuntimePHP ecosystem
LicenseTo be finalized

Where it fits

Put boundaries next to the code they protect.

Common starting points for ArchUnitPHP include the following project shapes.

Laravel projectsSymfony servicesComposer librariesLegacy PHP

Make the first boundary executable.

Add one meaningful rule, run it with the existing tests, and grow the architecture suite as the system reveals where it needs protection.

Start with ArchUnitPHP ↗