halleck45 / php-metrics
Static analyzer tool for PHP : Coupling, Cyclomatic complexity, Maintainability Index, Halstead's metrics... and more !
Fund package maintenance!
Requires
- php: >=8.1
- ext-tokenizer: *
- nikic/php-parser: ^5.4
- openmetrics-php/exposition-text: ^0.4.1
Requires (Dev)
- phake/phake: ^4.5.3
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.1
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-strict-rules: ^2.0
- phpunit/phpunit: ^10.5
- roave/security-advisories: dev-latest
- sebastian/comparator: >=5.0.0
- squizlabs/php_codesniffer: ^3.11
- symfony/dom-crawler: ^6.4
- vimeo/psalm: ^6.3
Suggests
- ext-dom: To allow XML parsing and report results.
- ext-yaml: To allow yaml parsing of configuration files.
Replaces
This package is auto-updated.
Last update: 2026-08-12 16:20:17 UTC
README
PhpMetrics provides metrics about PHP project and classes, with beautiful and readable HTML report.
Documentation | Twitter | Contributing
Quick start
Follow the quick start guide to get started.
# install the package as a dev dependency composer require phpmetrics/phpmetrics --dev # run PHPMetrics to analyze a folder and generate a report php ./vendor/bin/phpmetrics --report-html=myreport <folder-to-analyze>
Then open the generated ./myreport/index.html file in your browser.
You can use a configuration file to customize the report, add options, configure rules for Continuous Integration, etc.
Metrics
You'll find detailed list of metrics in documentation, or
running php ./vendor/bin/phpmetrics --metrics
Author
- Jean-François Lépine <@Halleck45>
License
See the LICENSE file.
Contributing
See the CONTRIBUTING file.
Support the project
PHPMetrics is built and maintained on free time. If it saved you some of yours:
- ⭐ Star the repository. It costs nothing and it is how most developers discover the tool.
- ❤️ Become a sponsor. Sponsorship directly funds maintenance time and the addition of new features and metrics.

