Skip to the content
Know your tech before you buy it. Makers: get listed from $49/mo

PHPMD

phpmd.org

  • Free plan
  • Windows
  • macOS
  • Linux
  • Self-hosted
7.5 Club score Visit phpmd.org

What PHPMD is

PHPMD analyzes PHP source code to flag possible bugs, inefficient patterns, overly complex expressions, and unused parameters, methods, or properties. Its predefined rulesets cover clean code, code size, controversial practices, design, naming, and unused code. The project also supports custom rules and security rules, and it can be used in continuous integration. Documented report options include JSON, SARIF, Checkstyle-compatible, GitHub, and GitLab; a GitLab renderer is available for GitLab CI.

PHPMD is free under the BSD 3-Clause license and runs on Linux, macOS, and Windows, or in a self-hosted setup. Installation options include a Phar, PHIVE, and Composer. The download page lists PHP >= 5.3.9 and PHP_Depend >= 2.0.0 as requirements. Phar files carry a signature associated with [email protected]. The homepage lists version 2.15.0, dated 2023/12/11, as the most recent release shown.

Who it suits

PHPMD suits PHP developers and teams who want code-quality checks in their workflow, including CI. It may also fit users who need custom rules or security rules.

Good to know, and what to watch

  • Free under the BSD 3-Clause license
  • Rule categories cover code quality and unused code
  • Supports custom and security rules
  • Offers GitLab CI reporting
  • Install via Phar, PHIVE, or Composer
  • No autofix support
  • No IDE support
  • Requires PHP and PHP_Depend

PHPMD

Free

Free plan

Getting started

  1. Open the PHPMD website
  2. Install the Phar package, PHIVE package, or Composer package
  3. Ensure PHP 5.3.9 or newer is available
  4. Install PHP_Depend 2.0.0 or newer
  5. Choose the documented rulesets or custom rules
  6. Configure a JSON, SARIF, Checkstyle, GitHub, or GitLab report

The Club's review

Overview

PHPMD is a free static analyzer dedicated to PHP source code. It is best suited to PHP developers and teams that want repeatable command-line checks in local builds or continuous integration, especially when configurable rules matter more than editor conveniences. The trade-off is a review-oriented tool: it identifies problems, but does not repair them for you.

Manuel Pichler founded the project and has been involved since 2009. PHPMD is released under the BSD 3-Clause license, and the homepage identifies version 2.15.0, dated 2023/12/11, as the latest release shown.

Key features

PHPMD's predefined rules look for possible bugs, code smells, inefficient or overcomplicated expressions, and unused parameters, methods, and properties. The documented rulesets cover clean code, code size, controversial practices, design, naming, and unused code. That range supports more than formatting enforcement: teams can use it to surface maintainability and design concerns during review.

Custom rules allow a project to align checks with its own conventions, while security rules add a security-focused dimension to the analysis. In practice, customization is valuable for established teams, but every finding still requires a developer to decide whether and how to change the code. There is no autofix, so PHPMD is not the right choice for teams expecting one-command remediation.

Installation is documented through a Phar archive, PHIVE, or Composer. Phar files are signed with a public key associated with [email protected], a useful provenance check for teams distributing a standalone binary. The stated requirements are PHP >= 5.3.9 and PHP_Depend >= 2.0.0, which should be checked before introducing it into older or tightly controlled environments.

Release notes document JSON, SARIF, Checkstyle-compatible, GitHub, and GitLab report renderers or options. A GitLab renderer is specifically available for GitLab CI, and general CI support makes the tool practical for pull-request or pipeline quality gates. IDE support is none, so developers who need inline diagnostics must pair PHPMD with other tooling.

Help is directed through the Gitter channel, while bugs and feature requests go to the issue tracker. Organizations wanting commercial support and maintenance for open-source dependencies can obtain PHPMD through the Tidelift Subscription.

Pricing

PlanPriceIncludes
PHPMDFreePHP source code analysis under the BSD 3-Clause license

There are no paid tiers, seat charges, usage quotas, or trial terms attached to this plan. The free distribution suits individual developers, open-source projects, and companies that can operate community-supported software. The financial saving comes with operational responsibility: teams needing a supported commercial relationship must use the separate Tidelift offering.

Platforms

PHPMD supports Linux, macOS, Windows, and self-hosted deployments. Its Phar, PHIVE, and Composer installation paths fit developer workstations as well as controlled build servers. Because the workflow is command-line and self-managed, organizations retain deployment control but must integrate editor feedback themselves.

Who it's for

Choose PHPMD for PHP codebases that need broad, configurable static checks in CI without a license budget. It is particularly suitable for teams willing to tune rulesets and review findings as part of a quality process.

Look elsewhere if automatic fixes, first-class IDE diagnostics, or a vendor-managed service are central requirements. PHPMD's output formats and CI support help automation, but the tool remains an analyzer rather than a complete developer-assistance suite.

Pros and cons

Pros

  • Broad PHP-focused coverage: rules span code quality, design, naming, complexity, controversial practices, and unused code.
  • Custom and security rules: teams can adapt checks beyond the predefined sets and include security-oriented analysis.
  • CI-ready reporting: JSON, SARIF, Checkstyle-compatible, GitHub, and GitLab outputs fit varied pipeline workflows.
  • No license cost: the free plan and BSD 3-Clause license remove per-seat and subscription barriers.
  • Flexible installation: Phar, PHIVE, and Composer options support different PHP delivery practices.

Cons

  • No autofix: every flagged issue needs manual investigation and editing.
  • No IDE support: findings are not delivered directly inside an editor through PHPMD.
  • Runtime dependencies: PHP and PHP_Depend version requirements add setup considerations for legacy environments.
  • Community-first support: routine help uses Gitter and issue tracking; commercial maintenance requires Tidelift.

Alternatives

For a broader directory of code-quality tools, browse Linters.

Cppcheck is the better fit when you need a free open-source core plus a separate paid Project option, or analysis across its Linux, macOS, Windows, and self-hosted platforms.

Pick actionlint instead for GitHub Actions workflow checking through a command-line tool and browser playground.

Astral suits teams seeking a collection of permissively licensed, open-source developer tools such as Ruff, uv, and ty.

Choose Biome for an open-source toolchain aimed at web projects, including extension and web availability.

PMD is the natural alternative when your primary language is not PHP and you want a downloadable, BSD-style licensed static analyzer.

Ruff is the alternative for Python-focused, high-performance linting and tooling.

Staticcheck fits Go projects seeking a completely free, open-source analyzer.

SwiftLint is the choice for open-source, MIT-licensed linting of Swift code.

Verdict

PHPMD is a strong choice for PHP teams that want broad, customizable static analysis and CI-compatible reports at no license cost. Its main reason to choose it is the combination of PHP-specific rules and flexible output; its main reason to look elsewhere is the absence of autofix and IDE support, which leaves remediation and editor integration to other tools.

The verdict

PHPMD offers PHP-focused checks, customizable rules, and several reporting options without a license cost. Its lack of autofix and IDE support may matter to developers who want fixes or feedback directly in an editor.

Questions people ask

Is PHPMD free?

Yes. The PHPMD plan costs nothing and uses the BSD 3-Clause license.

Which operating systems are supported?

PHPMD supports Linux, macOS, Windows, and self-hosted use.

What does PHPMD analyze?

It analyzes PHP source code for possible bugs, suboptimal code, overcomplicated expressions, and unused parameters, methods, or properties.

Can PHPMD run in CI?

Yes. It supports CI and documents a GitLab renderer for GitLab CI.

Which report formats are available?

Documented report renderers or options include JSON, SARIF, Checkstyle-compatible, GitHub, and GitLab.

What does installation require?

The listed requirements are PHP version 5.3.9 or newer and PHP_Depend version 2.0.0 or newer. Installation methods include Phar, PHIVE, and Composer.

What the maker publishes

Analysis rules
Its predefined rules detect code smells and possible errors in analyzed source code. source
Company details
The people page names Manuel Pichler as project founder and says he has been involved since 2009. source
Enterprise support
The enterprise page offers PHPMD through the Tidelift Subscription, which describes commercial support and maintenance for open-source dependencies. source
Founded
2009 source
GitLab CI
Release notes state that PHPMD added a GitLab renderer for GitLab CI. source
Installation
The site documents installation as a Phar, through PHIVE, or via Composer. source
Latest release shown
The homepage lists PHPMD 2.15.0, dated 2023/12/11, as its most recent release. source
License
The project site identifies PHPMD as licensed under the BSD 3-Clause license. source
PHP dependency
The download page lists PHP >= 5.3.9 and PHP_Depend >= 2.0.0 as requirements. source
Purpose
PHPMD analyzes PHP source code for possible bugs, suboptimal code, overcomplicated expressions, and unused parameters, methods, or properties. source
Reports
Release notes document JSON, SARIF, Checkstyle-compatible, GitHub, and GitLab report renderers or options. source
Rule categories
The documented rulesets cover clean code, code size, controversial practices, design, naming, and unused code. source
Signing
PHPMD Phar files are signed with a public key associated with [email protected]. source
Support
The support page directs users to the Gitter channel for help and the issue tracker for bugs or feature requests. source

Checked against the maker's pages on 7 Oct 2026.