PhpMetrics provides metrics about PHP project and classes, with beautiful and readable HTML report.
Documentation | Twitter | Contributing
composer require phpmetrics/phpmetrics --dev php ./vendor/bin/phpmetrics --report-html=myreport <folder-to-analyze> Then open the generated ./myreport/index.html file in your browser.
Use the --config=<file>.json option. For example:
{ "includes": [ // directory and files to analyze, relative to config file directory "src" ], "exclude": [ // regex of files (or directory) to exclude from analyze "tests" ], "report": { // list of reports to generate (html, json, csv or violation) "html": "/tmp/report/", // destination directory of HTML report "csv": "/tmp/report.csv", // destination file for CSV report "json": "/tmp/report.json", // destination file for JSON report "violations": "/tmp/violations.xml" // destination file for XML violations report }, "groups": [ // "layers" of code. You can group your classes and packages by regex, // to visualise specific HTML report for each of them { "name": "Component", // name of the layer "match": "!component!i" // regular expression used to match the group (based on // the name of the fully qualified class name) // remember to double escape (for json, then for regex): // set "!\\\\MyPackage\\\\!" if you want to capture // expression "\MyPackage\" }, { "name": "Example", "match": "!example!" } ], "plugins": { "git": { "binary": "git" // if defined, runs git analyze }, "junit": { "file": "/tmp/junit.xml" // if defined, JUnit report file will be analyzed } }, "extensions": [ "php", "php8" ] // default: ["php", "inc"] }If want, you can install PhpMetrics globally with your favorite package manager (APT, Brew...). You can also visit our documentation.
See the metrics file.
- Jean-François Lépine <@Halleck45>
See the LICENSE file.
See the CONTRIBUTING file.

