This package is abandoned and no longer maintained. The author suggests using the qossmic/deptrac package instead.

Deptrac is a static code analysis tool that helps to enforce rules for dependencies between software layers.

Installs: 3 784

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1 800

Watchers: 44

Forks: 82

Open Issues: 23

0.19.1 2022-01-16 12:53 UTC


Deptrac is a static code analysis tool for PHP that helps you communicate, visualize and enforce architectural decisions in your projects. You can freely define your architectural layers over classes and which rules should apply to them.

For example, you can use Deptrac to ensure that bundles/modules/extensions in your project are truly independent of each other to make them easier to reuse.

Deptrac can be used in a CI pipeline to make sure a pull request does not violate any of the architectural rules you defined. With the optional Graphviz formatter you can visualize your layers, rules and violations.


You can find the documentation in the /docs directory or visit the doc page:

Getting Started

You will need to create a configuration file, where you define your layers and communication ruleset. Once you have done that, you can analyse your code by running deptrac:

php deptrac.phar

# which is equivalent to
php deptrac.phar analyse --config-file=deptrac.yaml


Deptrac is in active development. We are looking for your suggestions and help to make it better.

Feel free to open an issue if you encounter bugs, have suggestions or would like to add a new feature to Deptrac.

Please feel free to improve this documentation, fix bugs, or work on a suggested feature by making a pull request on GitHub. Don't hesitate to ask for support, if you need help at any point.

The Contribution Guide in the documentation contains some advice for making a pull request with code changes.

Code of Conduct

If you are professional and polite then everything will be alright.

Please don't be inconsiderate or mean, or anything in between.