7,363 open-source and SaaS tools, with GitHub stats refreshed every day.

PhpMetrics

Open source

PhpMetrics is a static analysis tool that measures PHP code quality and produces readable HTML reports, with rules that can be enforced in CI.

phpmetrics.github.io
PhpMetrics homepage screenshot
GitHub stars
2.6k
Last commit
1 mo ago
Repository age
12 years
Version
v2.11.0
Licence
MIT
Self-hosted
Yes

About PhpMetrics

PhpMetrics is a static analysis tool for PHP projects. It analyzes your code and produces metrics about the project and its classes, presented in an HTML report designed to be easy to read, so teams can see where complexity, coupling and maintainability problems are concentrated.

You run it from the command line against your source directory, then open the generated report in a browser. A configuration file lets you customize the report, add options and define rules for continuous integration, and a list of the available metrics is in the documentation or can be printed from the tool. It is installed with Composer and is intended to be part of a regular quality workflow.

PhpMetrics is written in PHP and licensed under MIT. The author builds and maintains it in spare time and asks for stars or sponsorship to fund further work. It runs locally or in CI, so there is nothing to host, and it suits PHP developers and teams who want objective quality metrics to guide refactoring.

Key features

  • Metrics for PHP projects and classes
  • Readable HTML reports
  • Configurable rules for CI
  • Complexity and maintainability measures
  • Command-line usage
  • Composer installation

Good fit for

  • →Finding complex code to refactor
  • →Enforcing quality thresholds in CI
  • →Tracking maintainability of a PHP codebase
Built with
PHP
Tags
php
static-analysis
code-quality
metrics
ci
html-report
maintainability
cli
developer-tools

PhpMetrics: questions and answers

What is PhpMetrics used for?
PhpMetrics is a static analysis tool that measures PHP code quality and produces readable HTML reports, with rules that can be enforced in CI. It is a good fit for finding complex code to refactor, enforcing quality thresholds in CI and tracking maintainability of a PHP codebase.
Is PhpMetrics open source?
Yes. PhpMetrics is open source under the MIT licence. Its source code is on GitHub at phpmetrics/PhpMetrics and is written mainly in PHP.
Is PhpMetrics free?
Yes. PhpMetrics is open source, so the software itself is free to use.
What are some alternatives to PhpMetrics?
Similar open-source tools in the Developer Tools category include golangci-lint, PHP Insights and Revive. SaaS products in the same category include Qodana, act101 and Debtdrone.
Is PhpMetrics actively maintained?
Yes. The most recent commit to PhpMetrics was on 21 August 2026, and the latest release is v2.11.0, published on 9 August 2026. The project has 2.6k stars on GitHub.

Open-source alternatives to PhpMetrics

See all

SaaS alternatives to PhpMetrics

See all