Linux command
phploc 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Measure project size
phploc [src/]
Output as CSV
phploc --log-csv [stats.csv] [src/]
Exclude a directory
phploc --exclude [vendor] [.]
Count tests
phploc --count-tests [src/]
Analyze specific file suffixes
phploc --suffix [php] --suffix [inc] [src/]
Exclude multiple directories
phploc --exclude [vendor] --exclude [tests] [src/]
说明
phploc measures the size and complexity of a PHP project. It reports metrics including lines of code (LOC), comment lines, non-comment lines, number of classes, methods, functions, interfaces, traits, namespaces, constants, and cyclomatic complexity. The tool scans directories recursively for PHP files and generates a summary of structural metrics. It is part of the PHP QA toolchain created by Sebastian Bergmann.
参数
- --log-csv _FILE_
- Write results in CSV format to file.
- --log-xml _FILE_
- Write results in XML format to file.
- --exclude _DIR_
- Exclude directory from analysis. Can be specified multiple times.
- --suffix _SUFFIX_
- File suffix to include (default: php). Can be specified multiple times.
- --count-tests
- Include test-related metrics in the output.
- --names _NAMES_
- Comma-separated list of file names to include.
- --names-exclude _NAMES_
- Comma-separated list of file names to exclude.
- --help
- Display help information.
- --version
- Display version information.
FAQ
What is the phploc command used for?
phploc measures the size and complexity of a PHP project. It reports metrics including lines of code (LOC), comment lines, non-comment lines, number of classes, methods, functions, interfaces, traits, namespaces, constants, and cyclomatic complexity. The tool scans directories recursively for PHP files and generates a summary of structural metrics. It is part of the PHP QA toolchain created by Sebastian Bergmann.
How do I run a basic phploc example?
Run `phploc [src/]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --log-csv _FILE_ do in phploc?
Write results in CSV format to file.