We want to make sure that all our dependencies point in the right direction (e.g. Domain must not depend on anything, DataAccess may depend on ORM classes and Domain interfaces, etc) and that our architecture is sound.
There are some candidates for dependency analysis:
- https://github.com/mihaeu/dephpend (has pull requests for PHP 8.x compatibility, but is not compatible yet (last checked July 2023 ))
- https://github.com/qossmic/deptrac
- https://github.com/carlosas/phpat
The following candidates are unsuitable:
- https://github.com/j6s/phparch (Abandoned, recommends phpat)
- https://github.com/mamuz/PhpDependencyAnalysis (not compatible with PHP 8.x, last commit was 2019)
The decision on which library to use should be based on the following criteria:
- Does it allow to describe our restrictions? We want to check for test dependencies
- How readable and expressive is this description?
- How fast is the analysis?