Popularity
7.7
Declining
Activity
2.2
Declining
2,161
80
249

Code Quality Rank: L4
Programming language: PHP
License: MIT License
Tags: Testing     Code Analysis     Quality     Analysis     Qa    
Latest version: v2.7.4

PHP Metrics alternatives and similar libraries

Based on the "Code Analysis" category.
Alternatively, view PHP Metrics alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of PHP Metrics or a related project?

Add another 'Code Analysis' Library

README

PhpMetrics

License Build Status Latest Stable Version Slack

Standard report

PhpMetrics provides metrics about PHP project and classes, with beautiful and readable HTML report.

Documentation | Twitter | Contributing

Quick start

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.

Configure

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"]
}

More

If want, you can [install](doc/installation.md) PhpMetrics globally with your favorite package manager (APT, Brew...). You can also visit our documentation.

Metrics list

See the [metrics](doc/metrics.md) file.

Author

License

See the [LICENSE](LICENSE) file.

Contributing

See the [CONTRIBUTING](doc/contributing.md) file.


*Note that all licence references and agreements mentioned in the PHP Metrics README section above are relevant to that project's source code only.