A PHPStan extension for verifying architectural rules in PHP code using natural language definitions.
PHP Architecture Tester (PHPat) is a PHPStan extension that allows developers to define and test architectural rules in their PHP codebases. It solves the problem of architectural drift by providing automated validation of dependency constraints, layer boundaries, and other structural requirements. The tool integrates directly into the static analysis workflow, catching violations early in the development process.
PHP developers and teams working on medium to large codebases who need to maintain architectural consistency and prevent dependency violations. Particularly valuable for projects with layered architectures, domain-driven design, or strict separation of concerns.
PHPat offers a unique combination of PHPStan integration and natural language rule definitions, making architectural testing accessible without complex configuration. Unlike manual code reviews or documentation, it provides automated, repeatable validation that scales with the codebase.
✔️ PHP Architecture Tester - Easy architecture testing for PHP
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Allows defining architectural constraints in intuitive, human-readable syntax, as demonstrated in the example GIF, making it accessible without deep technical jargon.
Works as an extension to PHPStan, leveraging existing static analysis setups without requiring additional tools, as highlighted in the automatic activation via extension installer.
Scans the entire codebase to automatically verify adherence to rules, catching violations early in development, which is core to its philosophy of testable architecture.
Supports a wide range of architectural patterns, such as layered boundaries and dependency constraints, per the documentation examples, enabling customization for various project needs.
As warned in the README, early-stage releases (0.x.x) may introduce breaking changes, making it risky for production environments that require stability.
Requires PHPStan ^2.1 to function, adding complexity for projects not already using static analysis or those with incompatible versions.
While natural language simplifies setup, creating comprehensive architectural rules can still be time-consuming and may require deep understanding of the codebase structure.