PHPackages                             niels-de-blaauw/php-doc-check - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. niels-de-blaauw/php-doc-check

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

niels-de-blaauw/php-doc-check
=============================

Command line tool that identifies code that needs documentation.

v0.4.1(8mo ago)43246.0k↓63.9%4[11 issues](https://github.com/NielsdeBlaauw/php-doc-check/issues)[1 PRs](https://github.com/NielsdeBlaauw/php-doc-check/pulls)4MITPHP

Since Jan 16Pushed 8mo ago2 watchersCompare

[ Source](https://github.com/NielsdeBlaauw/php-doc-check)[ Packagist](https://packagist.org/packages/niels-de-blaauw/php-doc-check)[ RSS](/packages/niels-de-blaauw-php-doc-check/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (10)Dependencies (9)Versions (14)Used By (4)

php-doc-check
=============

[](#php-doc-check)

[![Latest Stable Version](https://camo.githubusercontent.com/57e0b296a0fa1132f1b3449e33b4ee2221589f1a8452dfef6579bcf6f17395ea/68747470733a2f2f706f7365722e707567782e6f72672f6e69656c732d64652d626c616175772f7068702d646f632d636865636b2f762f737461626c65)](https://packagist.org/packages/niels-de-blaauw/php-doc-check)[![Build Status](https://camo.githubusercontent.com/844098b6509de0ec6bf4f375502b23ebc0ceb66cdb632631d67e07ec65a2af55/68747470733a2f2f7472617669732d63692e6f72672f4e69656c736465426c616175772f7068702d646f632d636865636b2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/NielsdeBlaauw/php-doc-check)[![License](https://camo.githubusercontent.com/f2923ac7e7919d4dfd73346e2fefec47be8b0d0e8a93e89c9224b67da2662c9d/68747470733a2f2f706f7365722e707567782e6f72672f6e69656c732d64652d626c616175772f7068702d646f632d636865636b2f6c6963656e7365)](https://packagist.org/packages/niels-de-blaauw/php-doc-check)

PHP Doc Check is an automated command line tool to determine which functions and methods could use some more documentation.

By default this script:

- Emits a warning if there is no docblock for non trivial functions (score &gt; 4)
- Emits an error if there is no docblock for complex functions (score &gt; 6)

You can gradually improve documenation on projects by starting with relatively high limits and slowly moving these limits down.

Metrics
-------

[](#metrics)

- [Cognitive Complexity](https://www.sonarsource.com/docs/CognitiveComplexity.pdf) `` is used to find functions that are complex to read and understand.
- [Cyclomatic Complexity](https://en.wikipedia.org/wiki/Cyclomatic_complexity) is used to find complex functions with a more traditionl algorithm.

Installation
------------

[](#installation)

### Composer

[](#composer)

For now you have to install the beta version.

`composer require --dev niels-de-blaauw/php-doc-check:^0.2.0@dev`

### Phive

[](#phive)

`phive install php-doc-check`

Usage
-----

[](#usage)

```
$vendor/bin/php-doc-check -?
Usage: vendor/bin/php-doc-check [options]  [...]

Options:
  -x, --exclude                        Directories to exclude, without
                                            slash
  -f, --format                         Output format [text, json]
                                            [default: text]
  -o, --reportFile                     Send report output to a file
  -m, --metric                         Metric to use for determining
                                            complexity
                                            [metrics.complexity.cognitive,
                                            metrics.complexity.cyclomatic,
                                            metrics.deprecated.category,
                                            metrics.deprecated.subpackage,
                                            metrics.complexity.length]
                                            [default:
                                            metrics.complexity.cognitive]
  -w, --complexity-warning-threshold   Cyclomatic complexity score which
                                            is the lower bound for a warning
                                            [default: 4]
  -e, --complexity-error-threshold     Cyclomatic complexity score which
                                            is the lower bound for an error
                                            [default: 6]
  -$, --file-extension                 Valid file extensions to scan
                                            [default: php]
  -g, --grouping-method                Allows different grouping of the
                                            results list [file, none, metric,
                                            severity, fileline] [default: file]
  -s, --sorting-method                 Sorting for the results. Natural
                                            sorts by name for groups and line
                                            for findings. Value uses the
                                            cumulative group score, and finding
                                            score as sorting value. [natural,
                                            value] [default: natural]
  -i, --ignore-violations-on-exit           Will exit with a zero code, even if
                                            any violations are found
  -a, --ignore-anonymous-functions          Skip checks on anonymous functions
  -?, --help                                Show this help and quit
  -q, --quiet                               Don't show any output

```

Example first use: `vendor/bin/php-doc-check --exclude vendor ./`

Examples
--------

[](#examples)

This is fine without docblocks (trivial method)

```
public function get_title() : string{
    return strtoupper($this->title);
}
```

This could use some explanation

```
/**
 * Limits the length of the title to a normal sentence, because older titles
 * tend to be longer then we can currently show.
 */
public function get_title() : string{
    if(strlen($this->title) > 20 ){
        if(strpos($this->title,'.') !== false && strpos($this->title,'.') < 20){
            [$title] = explode('.', $this->title, 2);
        }else{
            $title = substr($this->title, 0, 17) . '...';
        }
    }else{
        $title = $this->title;
    }
    return strtoupper($title);
}
```

FAQ
---

[](#faq)

Q: Why dont you want if there is no comment at all, regardless of complexity?

A: You can set this software to warn for all functions that are undocumented by setting `--complexity-error-threshold 1`. However, if you want to force documentation, you probably want to look into a tool like [php CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer)in combination with documentation standards.

Q: Why isn't there a warning/error about complex functions and refactoring, regardless if they have a DocBlock?

A: You *should* refactor very complex functions. However, adding DocBlocks for complex function is often easier and safer. This tool only checks the availability of this type of documentation. Other tools, like [php Mess Detector](https://github.com/phpmd/phpmd), can help you limit complexity.

Issues
------

[](#issues)

Issues are in the GitHub tracker:

###  Health Score

48

—

FairBetter than 94% of packages

Maintenance56

Moderate activity, may be stable

Popularity45

Moderate usage in the ecosystem

Community19

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 92.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~210 days

Recently: every ~626 days

Total

13

Last Release

246d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/661876?v=4)[Niels de Blaauw](/maintainers/NielsdeBlaauw)[@NielsdeBlaauw](https://github.com/NielsdeBlaauw)

---

Top Contributors

[![NielsdeBlaauw](https://avatars.githubusercontent.com/u/661876?v=4)](https://github.com/NielsdeBlaauw "NielsdeBlaauw (37 commits)")[![menno-ll](https://avatars.githubusercontent.com/u/50165380?v=4)](https://github.com/menno-ll "menno-ll (2 commits)")[![nikserg](https://avatars.githubusercontent.com/u/5680589?v=4)](https://github.com/nikserg "nikserg (1 commits)")

---

Tags

automated-testingcicyclomatic-complexitydocblockdocblockshacktoberfestmetricsphpscore

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/niels-de-blaauw-php-doc-check/health.svg)

```
[![Health](https://phpackages.com/badges/niels-de-blaauw-php-doc-check/health.svg)](https://phpackages.com/packages/niels-de-blaauw-php-doc-check)
```

###  Alternatives

[typo3/cms

TYPO3 CMS is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.

1.2k1.9M122](/packages/typo3-cms)[phpdocumentor/reflection

Reflection library to do Static Analysis for PHP Projects

12526.9M158](/packages/phpdocumentor-reflection)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-laravel)[tempest/framework

The PHP framework that gets out of your way.

2.3k37.6k21](/packages/tempest-framework)[oat-sa/tao-core

TAO core extension

64147.9k151](/packages/oat-sa-tao-core)[brianhenryie/strauss

Prefixes dependencies namespaces so they are unique to your plugin

192484.7k41](/packages/brianhenryie-strauss)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
