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
golangci-lint
Developer Tools
Fast linters runner for Go
GPL-3.0★ 19kPHP Insights
Developer Tools
🔰 Instant PHP quality checks from your console
MIT★ 5.6k
Revive
Developer Tools
🔥 Fast, strict, configurable, extensible, and beautiful linter for Go
MIT★ 5.6k
Tach
Developer Tools
A Python tool to visualize + enforce dependencies, using modular architecture 🌎 Open sour
MIT★ 2.8k
SwiftInfo
Developer Tools
📊 Extract and analyze the evolution of an iOS app's code.
MIT★ 1.1k
Laravel Telescope
Developer Tools
An elegant debug assistant for the Laravel framework.
MIT★ 5.2k
SaaS alternatives to PhpMetrics
See all
Qodana
Developer Tools
JetBrains static analysis tool that brings IDE inspections to CI pipelines
SaaS
act101
Developer Tools
Codebase quality and refactoring toolkit for coding agents, with code porting and verification
SaaS
Debtdrone
Developer Tools
Scans codebases for technical debt and opens AI-generated pull requests to fix it
SaaS
Codacy
Developer Tools
Automated code quality and security analysis for pull requests
SaaS
Contextkit
Developer Tools
Workflow layer for AI coding agents with project memory, planning and short commands
SaaS
DeepSource
Developer Tools
Static analysis and code health platform with auto-fix suggestions
SaaS

