Skip to content

Commit 190b0fa

Browse files
authored
Update readme (#42)
1 parent 951e3f1 commit 190b0fa

File tree

1 file changed

+77
-37
lines changed

1 file changed

+77
-37
lines changed

README.md

Lines changed: 77 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
![](doc/logo.png)
22

3+
[![Go Report Card](https://goreportcard.com/badge/github.com/i582/phpstats)](https://goreportcard.com/report/github.com/i582/phpstats) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/i582/phpstats/master/LICENSE) ![](https://img.shields.io/badge/-%3C%3E%20with%20%E2%9D%A4-red)
4+
35
# phpstats
46

57
`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
810

911
This tool is written in [Go](https://golang.org/) and uses [NoVerify](https://github.com/VKCOM/noverify).
1012

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+
1123
![](doc/screen.png)
1224

13-
## What's currently available?
25+
## What is currently available?
1426

1527
### Metrics
1628

1729
1. `Afferent couplings`:
18-
1930
- for classes;
2031
- for namespaces;
21-
32+
2233
2. `Efferent couplings`:
2334
- for classes;
2435
- for namespaces;
@@ -33,7 +44,7 @@ This tool is written in [Go](https://golang.org/) and uses [NoVerify](https://gi
3344

3445
### Graph output (Graphviz format and svg)
3546

36-
1. File dependencies, both for root and inside functions;
47+
1. File dependencies, both root and included inside functions;
3748

3849
2. Class dependencies;
3950

@@ -44,34 +55,13 @@ This tool is written in [Go](https://golang.org/) and uses [NoVerify](https://gi
4455
4. All project namespaces;
4556

4657

47-
5. Specific namespace;
58+
5. Specific namespace and its child namespaces;
4859

4960

5061
7. LCOM4.
5162

5263
### Tops
5364

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-
7565
#### Classes
7666

7767
- by Lack of cohesion in methods;
@@ -124,20 +114,64 @@ The `--cache-dir` flag sets a custom cache directory.
124114

125115
The `--port` flag sets the port for the server. See the [server](#Server) part.
126116

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`.
128118

129-
#### Building graphs
119+
### Metrics
130120

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.
132122

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+
```
134127

135-
For command information, write `graph help`.
128+
For command information, write `info help`.
129+
130+
### Graph output (Graphviz format and svg)
136131

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.
138133

139134
```
140135
>>> 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.
141175
```
142176

143177
## Server
@@ -148,6 +182,8 @@ A local server (port 8080 by default) is used to interact with the analyzer from
148182

149183
### API
150184

185+
> All API responses are in `json` format.
186+
151187
`/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).
152188

153189
`/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
156192

157193
`/exit` — shutdown of the server.
158194

159-
`/analyzeStats`get the current analysis state.
195+
`/analyzeStats`getting the current analysis state.
160196

161-
## License
197+
## Contact
198+
199+
For any questions — tg: `@petr_makhnev`.
162200

163-
MIT
201+
## Contributing
164202

165-
---
203+
Feel free to contribute to this project. I am always glad to new people.
204+
205+
## License
166206

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

Comments
 (0)