Analyze
First analysis
This command analyzes the dependencies between classes in a given path.
The <path>
argument is the path to the directory to analyze.
Note
To obtain accurate results, it is crucial to analyze your entire codebase. If you perform a partial analysis, some nodes may appear incomplete.
Filtering results
To display only a list of namespaces, use the --only=
option.
To exclude a list of namespaces, use the --exclude=
option.
Graph rendering
You can render the graph of the analyzed classes using the --graph
option.
The color of the nodes indicates the stability of the class:
- A red node is strongly unstable.
- A yellow node is unstable.
- A green node is stable.
A red edge between two nodes indicates a weak dependency.
Note
This option generates a graph.html
file in the current directory.
Target class rendering
To render the graph of a specific class, use the --target=
option.
php class-dependencies-analyzer analyze app --target='App\Application\Analyze\AnalyzeAction' --graph
Note
It is necessary to analyze the entire codebase and use the --target=
option to target the class to render.
This will render the graph of all cascading dependencies of the target class.
You can limit the depth of the target class dependencies using the --depth-limit=
option.
php class-dependencies-analyzer analyze app --target='App\Application\Analyze\AnalyzeAction' --graph --depth-limit=2
With a depth limit of 2, only the dependencies of the target class and its direct dependencies will be displayed.