PHPackages                             voku/phpdoctor - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. voku/phpdoctor

ActiveLibrary[Testing &amp; Quality](/categories/testing)

voku/phpdoctor
==============

Type and PHPDoc quality profiling for PHP projects.

0.8.0(3w ago)53663[2 issues](https://github.com/voku/PHPDoctor/issues)[3 PRs](https://github.com/voku/PHPDoctor/pulls)Apache-2.0PHPPHP &gt;=8.1CI passing

Since Aug 31Pushed 2w ago1 watchersCompare

[ Source](https://github.com/voku/PHPDoctor)[ Packagist](https://packagist.org/packages/voku/phpdoctor)[ Docs](https://github.com/voku/PHPDoctor)[ Fund](https://www.paypal.me/moelleken)[ GitHub Sponsors](https://github.com/voku)[ RSS](/packages/voku-phpdoctor/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (10)Dependencies (7)Versions (54)Used By (0)

[![CI](https://github.com/voku/PHPDoctor/actions/workflows/ci.yml/badge.svg)](https://github.com/voku/PHPDoctor/actions/workflows/ci.yml)[![Latest Stable Version](https://camo.githubusercontent.com/539fb3145c9ddeb200ddc320f153854751d1f9777ef6def4f2be999625cc21e2/68747470733a2f2f706f7365722e707567782e6f72672f766f6b752f504850446f63746f722f762f737461626c65)](https://packagist.org/packages/voku/PHPDoctor)[![License](https://camo.githubusercontent.com/70c13846101830686fedee3c6303a2c6a4d7629e465bd1429f890150d30f3f52/68747470733a2f2f706f7365722e707567782e6f72672f766f6b752f504850446f63746f722f6c6963656e7365)](https://packagist.org/packages/voku/PHPDoctor)[![Donate to this project using Paypal](https://camo.githubusercontent.com/0d6e4d8b50b5983a58205941b1a581b1305903393b7a39da574e3f60af3c7f5b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f70617970616c2d646f6e6174652d79656c6c6f772e737667)](https://www.paypal.me/moelleken)[![Donate to this project using Patreon](https://camo.githubusercontent.com/f9e075baad95563481d35174d43ef50757281abb6bc795d0f473fad452afa030/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f70617472656f6e2d646f6e6174652d79656c6c6f772e737667)](https://www.patreon.com/voku)

🏥 ***PHPDoc***tor
=================

[](#-phpdoctor)

PHPDoctor: type and PHPDoc quality profiling for PHP projects.

If you already use [PHPStan](https://phpstan.org/r/db8ec6af-8815-444e-b533-2717ccb643c6) for your type checks but sometimes someone in the team still commit non typed code, then PHPDoctor is for you.

PHPDoctor keeps its original PHPDoc doctor identity as the first diagnostic stage and grows from there. It checks missing native types, missing or wrong PHPDoc types, deprecated documentation gaps, parse errors, and other type-documentation regressions without trying to replace PHPStan, Psalm, or a generic architecture review.

### Install via "phar" (**recommended**)

[](#install-via-phar-recommended)

```
curl -L https://github.com/voku/PHPDoctor/releases/latest/download/phpdoctor.phar -o phpdoctor.phar
chmod +x phpdoctor.phar
```

All releases:

### Install via "composer require"

[](#install-via-composer-require)

```
composer require-dev voku/phpdoctor
```

### Quick Start

[](#quick-start)

```
Usage:
  analyse [options] [--]

Arguments:
  path                                                                                   The path to analyse

Options:
      --autoload-file[=AUTOLOAD-FILE]                                                    The path to your autoloader. [default: ""]
      --access[=ACCESS]                                                                  Check for "public|protected|private" methods. [default: "public|protected|private"]
      --skip-ambiguous-types-as-error[=SKIP-AMBIGUOUS-TYPES-AS-ERROR]                    Skip check for ambiguous types. (false or true) [default: "false"]
      --skip-deprecated-functions[=SKIP-DEPRECATED-FUNCTIONS]                            Skip check for deprecated functions / methods. (false or true) [default: "false"]
      --skip-functions-with-leading-underscore[=SKIP-FUNCTIONS-WITH-LEADING-UNDERSCORE]  Skip check for functions / methods with leading underscore. (false or true) [default: "false"]
      --skip-parse-errors[=SKIP-PARSE-ERRORS]                                            Skip parse errors in the output. (false or true) [default: "true"]
      --path-exclude-regex[=PATH-EXCLUDE-REGEX]                                          Skip some paths via regex e.g. "#/vendor/|/other/.*/path/#i" [default: "#/vendor/|/tests/#i"]
      --file-extensions[=FILE-EXTENSIONS]                                                Check different file extensions e.g. ".php|.php4|.php5|.inc" [default: ".php"]
      --profile[=PROFILE]                                                                Show a type and PHPDoc quality profile summary. (false or true) [default: "false"]
      --output-format[=OUTPUT-FORMAT]                                                    Output format for the analysis result. (text, json or github) [default: "text"]
      --baseline-file[=BASELINE-FILE]                                                    Compare against a PHPDoctor JSON baseline file so only new findings fail.
      --generate-baseline[=GENERATE-BASELINE]                                            Write the current type and PHPDoc profile to --baseline-file. (false or true) [default: "false"]

```

### Staged profiling

[](#staged-profiling)

PHPDoctor is evolving in focused stages:

1. keep the existing PHPDoc and native type diagnostics as the seed;
2. add structured profiling around the current findings;
3. support JSON baselines so CI can fail only on newly introduced findings;
4. provide project-level summaries for actionable type documentation coverage;
5. expose machine-readable JSON for CI dashboards.

This stays intentionally narrow: PHPDoctor profiles type documentation quality and controlled regressions, not generic code quality scores.

Show a profile summary:

```
php vendor/bin/phpdoctor analyse src --profile=true
```

Generate a baseline:

```
php vendor/bin/phpdoctor analyse src --baseline-file=phpdoctor-baseline.json --generate-baseline=true
```

Use the baseline in CI so only new findings fail:

```
php vendor/bin/phpdoctor analyse src --baseline-file=phpdoctor-baseline.json
```

Emit JSON for dashboards:

```
php vendor/bin/phpdoctor analyse src --output-format=json
```

Emit GitHub Actions workflow annotations:

```
php vendor/bin/phpdoctor analyse src --output-format=github
```

Use GitHub Actions annotations with a minimal workflow step:

```
- name: Run PHPDoctor GitHub annotations
  run: php vendor/bin/phpdoctor analyse src --output-format=github
```

Use baseline-aware GitHub Actions annotations so only new findings are annotated:

```
- name: Run PHPDoctor GitHub annotations with baseline
  run: php vendor/bin/phpdoctor analyse src --baseline-file=phpdoctor-baseline.json --output-format=github
```

Exit codes:

- `0`: no findings, or no new findings when `--baseline-file` is active
- `1`: findings found, or new findings found when `--baseline-file` is active
- `2`: CLI, configuration, or baseline errors

### Demo

[](#demo)

Parse a string:

```
$code = '
