A static code analysis tool for PHP that enforces architectural layers and dependencies between classes.
Deptrac is a static code analysis tool for PHP that helps developers define, visualize, and enforce architectural layers and dependencies in their codebases. It solves the problem of architectural drift by allowing teams to set clear rules about which parts of the code can communicate with each other, ensuring modular and maintainable projects.
PHP developers and teams working on medium to large projects who need to enforce architectural boundaries, such as ensuring modules or bundles remain independent and decoupled.
Developers choose Deptrac because it provides a flexible, code-first approach to architectural enforcement, integrates seamlessly into CI/CD pipelines, and offers visualization tools to make dependencies and violations immediately understandable.
Keep your architecture clean.
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 free definition of architectural layers using various collectors like class name or directory, enabling custom boundaries tailored to any PHP project structure.
Can be integrated into CI pipelines to automatically block pull requests violating architectural rules, ensuring codebase integrity and preventing drift.
Supports output formats like Graphviz and Mermaid.js to generate visual diagrams of layers and dependencies, making violations immediately understandable.
Offers both YAML and PHP configuration files, providing choice and ease of integration into different project setups and workflows.
Requires at least PHP 8.1 to run, which can be a barrier for teams on older, unsupported PHP versions, even though it can analyze such code.
Defining architectural layers and rules from scratch is time-consuming and complex, especially for large or legacy codebases without clear boundaries.
Might miss dependencies introduced at runtime, such as those from dynamic class loading or reflection, leading to false negatives in enforcement.
Requires understanding collectors, layers, and rules in configuration files, demanding significant upfront investment to use effectively.