You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`phpstats` is a utility for collecting project statistics and building dependency graphs for PHP, that allows you to find places in the code that can be improved.
@@ -8,17 +10,26 @@ It tries to be fast, ~150k LOC/s (lines of code per second) on Core i5 with SSD
8
10
9
11
This tool is written in [Go](https://golang.org/) and uses [NoVerify](https://github.com/VKCOM/noverify).
10
12
13
+
## Table of Contents
14
+
15
+
*[What is currently available?](#what-is-currently-available)
16
+
*[Install](#install)
17
+
*[Usage](#usage)
18
+
*[Server](#server)
19
+
*[Contact](#contact)
20
+
*[Contributing](#contributing)
21
+
*[License](#license)
22
+
11
23

12
24
13
-
## What's currently available?
25
+
## What is currently available?
14
26
15
27
### Metrics
16
28
17
29
1.`Afferent couplings`:
18
-
19
30
- for classes;
20
31
- for namespaces;
21
-
32
+
22
33
2.`Efferent couplings`:
23
34
- for classes;
24
35
- for namespaces;
@@ -33,7 +44,7 @@ This tool is written in [Go](https://golang.org/) and uses [NoVerify](https://gi
33
44
34
45
### Graph output (Graphviz format and svg)
35
46
36
-
1. File dependencies, both for root and inside functions;
47
+
1. File dependencies, both root and included inside functions;
37
48
38
49
2. Class dependencies;
39
50
@@ -44,34 +55,13 @@ This tool is written in [Go](https://golang.org/) and uses [NoVerify](https://gi
44
55
4. All project namespaces;
45
56
46
57
47
-
5. Specific namespace;
58
+
5. Specific namespace and its child namespaces;
48
59
49
60
50
61
7. LCOM4.
51
62
52
63
### Tops
53
64
54
-
Tops displays information about the top functions, classes and files. The `top` command is used to display the top.
55
-
56
-
```
57
-
>>> top classes
58
-
# shows the top 10 classes.
59
-
```
60
-
61
-
To show the list in reverse, add the file `-r`. To control the count and offset in the list, use the `-c` and `-o` flags, respectively.
62
-
63
-
```
64
-
>>> top classes -c 100 -o 10 -r
65
-
# shows the top 100 classes from the end, starting from the 10th.
66
-
```
67
-
68
-
Supported output to a file in `json` format, for this add the `--output` flag and the path to the file to which you want to write the list.
69
-
70
-
```
71
-
>>> top classes --output top-classes.json
72
-
# outputs the top 10 classes to top-classes.json file.
73
-
```
74
-
75
65
#### Classes
76
66
77
67
- by Lack of cohesion in methods;
@@ -124,20 +114,64 @@ The `--cache-dir` flag sets a custom cache directory.
124
114
125
115
The `--port` flag sets the port for the server. See the [server](#Server) part.
126
116
127
-
After collecting information you will be taken to an interactive shell, for help, enter "help".
117
+
After collecting information you will be taken to an interactive shell, for help, enter `help`.
128
118
129
-
#### Building graphs
119
+
###Metrics
130
120
131
-
The graph command is used to build graphs. The required flag is the `-o` flag which sets the output file with the graph.
121
+
To view the metrics, use the `info`command, which shows information about classes, functions and files by their names. The search is not strict, so it is not necessary to enter the full name.
132
122
133
-
When creating a graph, two files are created, one with the source code of the graph in the graphviz language and a file with the graph in svg format.
123
+
```
124
+
>>> info class ClassName
125
+
# show information about ClassName class.
126
+
```
134
127
135
-
For command information, write `graph help`.
128
+
For command information, write `info help`.
129
+
130
+
### Graph output (Graphviz format and svg)
136
131
137
-
Example:
132
+
To build graphs, use the `graph` command. The `-o` flag is required and sets the file in which the graph will be placed.
138
133
139
134
```
140
135
>>> graph class -o graph.svg ClassName
136
+
# outputs the graph for the ClassName class dependencies to the graph.svg file.
137
+
```
138
+
139
+
When creating a graph, two files are created, one with the source code of the graph in the `graphviz` format and a file with the graph in `svg` format.
140
+
141
+
For command information, write `graph help`.
142
+
143
+
### Tops
144
+
145
+
Tops displays information about the top functions, classes and files. The `top` command is used to display the top.
146
+
147
+
```
148
+
>>> top classes
149
+
# shows the top 10 classes.
150
+
```
151
+
152
+
To show the list in reverse, add the file `-r`. To control the count and offset in the list, use the `-c` and `-o` flags, respectively.
153
+
154
+
```
155
+
>>> top classes -c 100 -o 10 -r
156
+
# shows the top 100 classes from the end, starting from the 10th.
157
+
```
158
+
159
+
Supported output to a file in `json` format, for this add the `--output` flag and the path to the file to which you want to write the list.
160
+
161
+
```
162
+
>>> top classes --output top-classes.json
163
+
# outputs the top 10 classes to the top-classes.json file.
164
+
```
165
+
166
+
For command information, write `top help`.
167
+
168
+
### Brief project information
169
+
170
+
Use the `brief` command to show brief information about the project.
171
+
172
+
```
173
+
>>> brief
174
+
# shows brief information.
141
175
```
142
176
143
177
## Server
@@ -148,6 +182,8 @@ A local server (port 8080 by default) is used to interact with the analyzer from
148
182
149
183
### API
150
184
185
+
> All API responses are in `json` format.
186
+
151
187
`/info/class?name=value` — getting information about the class by its name (the name does not have to be completely the same, the search is not strict).
152
188
153
189
`/info/func?name=value` — getting information about a function by its name.
@@ -156,12 +192,16 @@ A local server (port 8080 by default) is used to interact with the analyzer from
156
192
157
193
`/exit` — shutdown of the server.
158
194
159
-
`/analyzeStats` — get the current analysis state.
195
+
`/analyzeStats` — getting the current analysis state.
160
196
161
-
## License
197
+
## Contact
198
+
199
+
For any questions — tg: `@petr_makhnev`.
162
200
163
-
MIT
201
+
## Contributing
164
202
165
-
---
203
+
Feel free to contribute to this project. I am always glad to new people.
204
+
205
+
## License
166
206
167
-
**<>** with ❤
207
+
This project is under the MIT License. See the [LICENSE](https://github.com/i582/phpstats/blob/master/LICENSE) file for the full license text.
0 commit comments