Static analysis without loading the application
Architecture testing for PHP
ArchUnitPHP
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.
Roadmap
Follow the public foundation backlog$rule = ArchUnit::projectFiles()
->inFolder('src/Api/**')
->shouldNot()
->dependOnFiles()
->inFolder('src/Infrastructure/**');
ArchAssert::passes($rule);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.
Composer autoloading and symbol resolution
Lazy and immutable rule builders
PHPUnit and Pest integration targets
Structured violations
Pure graph and end-to-end test boundaries
Current maturity
Foundation stage
A public delivery skeleton and design target, not a Composer package or released API yet.
Where it fits
Put boundaries next to the code they protect.
Common starting points for ArchUnitPHP include the following project shapes.
More ecosystems
The same intent, expressed natively.
Explore sibling implementations and carry the architecture vocabulary across a polyglot system.
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 ↗