PHPackages                             pretzlaw/phpunit-docgen - 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. pretzlaw/phpunit-docgen

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

pretzlaw/phpunit-docgen
=======================

Generate test evidence or documentation by using doc comments.

3.0.0(6y ago)218.6k—0%41MITPHPPHP &gt;=7.1

Since Dec 12Pushed 6y agoCompare

[ Source](https://github.com/pretzlaw/phpunit-docgen)[ Packagist](https://packagist.org/packages/pretzlaw/phpunit-docgen)[ RSS](/packages/pretzlaw-phpunit-docgen/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (5)Versions (8)Used By (1)

Documentation generator via PHPUnit
===================================

[](#documentation-generator-via-phpunit)

Usage
-----

[](#usage)

Require package:

```
composer require pretzlaw/phpunit-docgen

```

Write this in your `phpunit.xml`:

```

            test-evidence.md

```

It will output all your doc comments as a nice markdown. This brings up a nice test evidence for unit tests or some kind of documentation when running integration tests.

Example / Best usage
--------------------

[](#example--best-usage)

Imaigne you need to describe an API or deliver the customer some test-evidence what is guaranteed by unit testing / integration test containing ...

- tests/
    - FooController/
        - CreateTest.php
        - ShowTest.php
        - ...
    - FooControllerTest.php

Just a few **doc comments can generate those documents**. The following has been generated by the doc comments of such tests (`Tests\FooControllerTest` did this):

```
# Foo Fighters

This is an API for managing Foo. It allows:

- Create
- Read

```

`Tests\FooController\CreateTest` added this:

```
## How to create a new one?

Creating is easy as long as you stick to the range.

### Request

Do `POST /foo` with some data.

```

`Tests\FooController\ShowTest` added this:

```
## Read out all foo

### Restrictions

You can't see more than five. This is because ...

At least one will be at the drums. Because ...

```

### Headings and Text

[](#headings-and-text)

Within the `FooControllerTest.php` we have:

```
namespace Tests;

/**
 * Foo Fighters
 *
 * This is an API for managing Foo. It allows:
 *
 * - Create
 * - Read
 *
 * @since 1994
 */
class FooControllerTest {}

```

This is what turns into the first section (see example doc above). It simply puts the doc comment without `@` attributes in the output.

### Depth / Structure

[](#depth--structure)

Subsections will be done by parsing the namespace and (afterwards) by the methods a test contains:

```
namespace Tests\FooController;

/**
 * How to create a new one?
 *
 * Creating is easy as long as you stick to the range.
 *
 */
class CreateTest {
  /**
   * Request
   *
   * Do `POST /foo` with some data.
   *
   */
  function testBar() {
    $this->assertTrue( (new FooController)->create() );
  }
}

```

This is how the second section is created (see above).

Append content to another heading
=================================

[](#append-content-to-another-heading)

When you are within one test it means you are testing one context so sometimes you like to add documentation to some heading. Just use the heading for all those tests again:

```
/**
 * Read out all foo
 *
 */
class ShowTest {

  /**
   * Restrictions
   *
   * You can't see more than five. This is because ...
   */
  function testBar() {}

  /**
   * Restrictions
   *
   * At least one will be at the drums. Because ...
   */
  function testBaz() {}
}

```

Ignore one method or class / Do not print in doc
================================================

[](#ignore-one-method-or-class--do-not-print-in-doc)

- Mark it with an `@internal`.
- Comments without heading or content will be ignored too.

Cheers!

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 50% 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 ~182 days

Recently: every ~216 days

Total

6

Last Release

2534d ago

Major Versions

1.1.0 → 2.0.02018-05-27

2.1.0 → 3.0.02019-06-10

### Community

Maintainers

![](https://www.gravatar.com/avatar/43cfe7528adedb7318b4d1e680eb50ad8cd2a17fd7bc4417359cd0d711bad988?d=identicon)[sourcerer-mike](/maintainers/sourcerer-mike)

---

Top Contributors

[![pretzlaw](https://avatars.githubusercontent.com/u/24290366?v=4)](https://github.com/pretzlaw "pretzlaw (8 commits)")[![ScreamingDev](https://avatars.githubusercontent.com/u/2559177?v=4)](https://github.com/ScreamingDev "ScreamingDev (8 commits)")

### Embed Badge

![Health badge](/badges/pretzlaw-phpunit-docgen/health.svg)

```
[![Health](https://phpackages.com/badges/pretzlaw-phpunit-docgen/health.svg)](https://phpackages.com/packages/pretzlaw-phpunit-docgen)
```

###  Alternatives

[codeception/codeception

All-in-one PHP Testing Framework

4.9k86.2M2.9k](/packages/codeception-codeception)[ta-tikoma/phpunit-architecture-test

Methods for testing application architecture

10745.9M13](/packages/ta-tikoma-phpunit-architecture-test)[ergebnis/phpunit-slow-test-detector

Provides facilities for detecting slow tests in phpunit/phpunit.

1468.1M72](/packages/ergebnis-phpunit-slow-test-detector)[lmc/steward

Steward - makes Selenium WebDriver + PHPUnit testing easy and robust

222163.1k1](/packages/lmc-steward)[webmozarts/strict-phpunit

Enables type-safe comparisons of objects in PHPUnit

31252.7k5](/packages/webmozarts-strict-phpunit)

PHPackages © 2026

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