LinuxCommandLibrary

phploc

measures PHP project size and complexity

TLDR

Measure project size
$ phploc [src/]
copy
Output as CSV
$ phploc --log-csv [stats.csv] [src/]
copy
Exclude a directory
$ phploc --exclude [vendor] [.]
copy
Count tests
$ phploc --count-tests [src/]
copy
Analyze specific file suffixes
$ phploc --suffix [php] --suffix [inc] [src/]
copy
Exclude multiple directories
$ phploc --exclude [vendor] --exclude [tests] [src/]
copy

SYNOPSIS

phploc [options] directories...

DESCRIPTION

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.

PARAMETERS

DIRECTORIES

One or more directories to analyze.
--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.

CAVEATS

Phploc has been archived by its author and is no longer actively maintained. It analyzes directories recursively by default. Only files with the `.php` suffix are scanned unless changed with `--suffix`.

HISTORY

PHPLOC was created by Sebastian Bergmann, also known for PHPUnit, as part of the PHP quality assurance toolkit.

SEE ALSO

cloc(1), phpmd(1), phpcs(1), sloccount(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard