PHPackages                             donatj/mddoc - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. donatj/mddoc

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

donatj/mddoc
============

Powerful, User Directed Markdown Documentation Generator

v0.10.1(2y ago)150.2k↑24.3%1[2 PRs](https://github.com/donatj/mddoc/pulls)4MITPHPPHP &gt;=7.2CI passing

Since Mar 15Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/donatj/mddoc)[ Packagist](https://packagist.org/packages/donatj/mddoc)[ Fund](https://www.paypal.me/donatj/15)[ GitHub Sponsors](https://github.com/donatj)[ RSS](/packages/donatj-mddoc/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (10)Versions (23)Used By (4)

MDDoc
=====

[](#mddoc)

[![Latest Stable Version](https://camo.githubusercontent.com/185d2fa873794cabb3750d928c8de2ffe96606cd479850731c2c1867804c8757/68747470733a2f2f706f7365722e707567782e6f72672f646f6e61746a2f6d64646f632f76657273696f6e)](https://packagist.org/packages/donatj/mddoc)[![Total Downloads](https://camo.githubusercontent.com/f170ff54a284eb07e81a92c4f115e6fccc02f1996d5dc8fe24a61b62141cb36f/68747470733a2f2f706f7365722e707567782e6f72672f646f6e61746a2f6d64646f632f646f776e6c6f616473)](https://packagist.org/packages/donatj/mddoc)[![License](https://camo.githubusercontent.com/2e1891a4a333e75b57bbc4c357f6cc1b0945bf88da97b1a9067138d33ecb2ba1/68747470733a2f2f706f7365722e707567782e6f72672f646f6e61746a2f6d64646f632f6c6963656e7365)](https://packagist.org/packages/donatj/mddoc)[![ci.yml](https://github.com/donatj/mddoc/actions/workflows/ci.yml/badge.svg)](https://github.com/donatj/mddoc/actions/workflows/ci.yml)

A simple, directed markdown documentation generator for PHP projects.

A simple use-case is to generate a README.md based on the project's source code as well as other options as defined in the config file.

This projects allows you to define a set of directives for *how* to document a project, and output to markdown.

This allows everything from README's to entire websites to be generated using this tool.

This is done using a simple, expressive XML syntax. This includes:

- Automatic documentation of code
- Automatic composer requirements / installation instructions
- Raw and code-tag wrapped file inclusion
- Script output
- Automatic Badge Creation
- Creating sub-documents
- Much more

Requirements
------------

[](#requirements)

- **php**: &gt;=7.2
- **ext-dom**: \*
- **ext-json**: \*
- **ext-libxml**: \*
- **donatj/cli-toolkit**: ^0.3.1
- **donatj/flags**: ^1.5
- **donatj/mddom**: ^0.2.0
- **phpdocumentor/reflection**: ~5.2.0
- **psr/log**: ^1|^2|^3
- **symfony/polyfill-php80**: ^1.28

Examples
--------

[](#examples)

- PhpUserAgent's [README](https://github.com/donatj/PhpUserAgent)
- [boomerang.work](https://boomerang.work/) - The documentation site for Boomerang\*!\* is fully generated using this tool.

This very README you are reading (also including [DOCS.md](DOCS.md)) is generated by the file [.mddoc.xml.dist](.mddoc.xml.dist)

```

A simple, directed markdown documentation generator for PHP projects.

A simple use-case is to generate a README.md based on the project's source code as well as other options as defined in the config file.

This projects allows you to define a set of directives for *how* to document a project, and output to markdown.

This allows everything from README's to entire websites to be generated using this tool.

This is done using a simple, expressive XML syntax. This includes:

- Automatic documentation of code
- Automatic composer requirements / installation instructions
- Raw and code-tag wrapped file inclusion
- Script output
- Automatic Badge Creation
- Creating sub-documents
- Much more

]]>

- PhpUserAgent's [README](https://github.com/donatj/PhpUserAgent)
- [boomerang.work](https://boomerang.work/) - The documentation site for Boomerang*!* is fully generated using this tool.

This very README you are reading (also including [DOCS.md](DOCS.md)) is generated by the file [.mddoc.xml.dist](.mddoc.xml.dist)
]]>

```

Full API Docs (WIP)
-------------------

[](#full-api-docs-wip)

[See: DOCS.md](DOCS.md)

Configuration Syntax
--------------------

[](#configuration-syntax)

### ``

[](#autoloader-)

Specifies an PHP autoloader to use for the documentation generation

This autoloader is used at the current documentation level and inherited by
all children

Multiple autoloaders can be specified, and they will be checked in the order
they are specified

These are necessary to specify by hand because the composer autoloaders
do not provide a method to locate a class by name without loading it,
which is necessary for documentation generation without code execution.

#### Attributes:

[](#attributes)

- `type` **(required)** - The type of autoloader to use, either "psr0" or "psr4"
- `root` **(required)** - The root directory of the autoloader
- `namespace` - The namespace of the autoloader, only used for psr4

### `…`

[](#sectionsection)

Define a logical section of the generated documentation

Nesting sections results in the header level being increased (h1, h2, h3, etc)

Example:

```

          Some Text

```

Results in:

```
# This is an H1

## This is an H2

### This is an H3

Some Text
```

#### Attributes:

[](#attributes-1)

- `title` **(required)** - The heading of the section

### `…`

[](#replacereplace)

Replace text in the wrapped content. Optionally use a preg\_replace() regex.

#### Attributes:

[](#attributes-2)

- `search` **(required)** - The text to search for
- `replace` **(required)** - The text to replace with
- `regex` - Whether to use a regex or not - expects "true" or "false" - defaults to "false"

### `…`

[](#docpagedocpage)

Documentation page - stores the contents of child elements to a file

Nesting docpages results in a link being added in the parent page to the child page

Inherits all attributes from ``

#### Attributes:

[](#attributes-3)

- `target` **(required)** - Filename to output
- `link` - Optional custom link for parent documents
- `link-text` - Optional custom text for the link in parent documents
- `link-pre-text` - Optional custom text to precede the link in parent documents
- `link-post-text` - Optional custom text to follow the link in parent documents

### ``

[](#text-)

Include either raw or cdata text content

Example:

```
Some Text
Some Text]]>
```

### ``

[](#file-)

Generate documentation for a single PHP file

#### Attributes:

[](#attributes-4)

- `name` **(required)** - The file to document
- `skip-class-header` *\[recursive\]* - Skip the class header line
- `skip-class-constants` *\[recursive\]* - Skip the class constants section
- `method-filter` - Regex to filter methods by - specify methods to be matched
- `skip-method-returns` - Skip the method return section
- `warn-undocumented` *\[recursive\]* - Generate warning for undocumented methods. Defaults to "true".

### `…`

[](#recursive-directoryrecursive-directory)

Recursively search a directory for php files to generate documentation for

#### Attributes:

[](#attributes-5)

- `name` **(required)** - The directory to recursively search for files to document
- `file-filter` - A regex to filter files by - specify files to be matched

### ``

[](#include-)

Include the contents of a file

#### Attributes:

[](#attributes-6)

- `name` **(required)** - The poth of the file to include

### ``

[](#source-)

Include a source code block either as a file or inline

Example:

```

console.log('Hello World');

```

#### Attributes:

[](#attributes-7)

- `name` - filename of optional source file
- `lang` - Optional language name for the opening

### ``

[](#composer-install-)

Reads the current projects' composer.json file and outputs the install command

#### Attributes:

[](#attributes-8)

- `text` - Text to display before the install command
- `global` - Whether to include global subcommand
- `dev` - Whether to include --dev flag
- `package-names` - Package name override. Comma delimited. Defaults to `name` key of composer.json

### ``

[](#composer-requires-)

Reads the current projects' composer.json file and outputs the required packages, versions and extensions

### ``

[](#badge-)

Include a badge "shield" image from a given url

#### Attributes:

[](#attributes-9)

- `src` - The image url **(required)**
- `alt` - The image alt text **(required)**
- `href` - The optional url to link to wrap the badge in
- `title` - The optional link title

### ``

[](#badge-coveralls-)

Include a coverage badge from BadgeCoveralls.io

#### Attributes:

[](#attributes-10)

- `name` **(required)** - The BadgeCoveralls name of the Project.

This includes the service name, e.g. "github/donatj/php-dnf-solver"

- `branch` - The branch to show. Defaults to empty which shows the default branch

### ``

[](#badge-poser-)

Include a badge "shield" image from Pugx Poser

#### Attributes:

[](#attributes-11)

- `type` **(required)** - The type of badge to display. One of: "version" "downloads" "unstable" "license" "monthly" "daily" "phpversion"
    "composerlock"
- `name` - The packagist name of the package. Defaults to the name key of the composer.json file in the root of the project. Required if the composer.json file is not present.
- `suffix` - The poser endpoint to use. Defaults based on the type

### ``

[](#badge-travis-)

Include a badge "shield" image from Travis CI

#### Attributes:

[](#attributes-12)

- `name` **(required)** - The packagist name of the Travis Project. Defaults to the name key of the composer.json file in the root of the
    project. Required if the composer.json file is not present.
- `branch` - The branch to show. Defaults to "master"

### ``

[](#badge-scrutinizer-)

Include a badge "shield" image from Scrutinizer CI

#### Attributes:

[](#attributes-13)

- `name` **(required)** - The packagist name of the Scrutinizer Project. Defaults to the name key of the composer.json file in the root of
    the project. Required if the composer.json file is not present.
- `type` **(required)** - The type of badge to display. One of: "quality" "coverage" "build-status"
- `suffix` - The Scrutinizer endpoint to use. Defaults based on the type
- `branch` - The branch to show. Defaults to "master"

### ``

[](#badge-shielded-)

Include a badge "shield" image from Shielded.dev

Either the id or the color, title, and text options must be provided.

#### Attributes:

[](#attributes-14)

- `id` - The ID of the badge to display when displaying a dynamic badge.
- `color` - The color of the badge when displaying a static badge.
- `title` - The title of the badge when displaying a static badge.
- `text` - The text of the badge when displaying a static badge.

### ``

[](#badge-github-action-)

Include a badge "shield" image for a GitHub Actions workflow

#### Attributes:

[](#attributes-15)

- `name` **(required)** - The name of the `.yml` file in the `.github/workflows/` directory including the `.yml` extension
- `branch` - The name of the branch to show the badge for. Defaults to the default branch.
- `event`
- `workflow-file` **(required)** - The filename of the workflow file to use as the badge source

### ``

[](#exec-)

Execute a command and include the standard output in the documentation

#### Attributes:

[](#attributes-16)

- `cmd` **(required)** - The command to execute
- `format` - The format to output the result in - options include "raw" "code" and "code-block" defaults to "raw"
- `allow-error` - Set to 'true' to allow non-zero exit codes to continue

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance56

Moderate activity, may be stable

Popularity32

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96.6% 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 ~71 days

Recently: every ~7 days

Total

14

Last Release

896d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a57a02ba022451a54d4b65e227ce3d032cadc638a644c2d4b56f0313632ee656?d=identicon)[donatj](/maintainers/donatj)

---

Top Contributors

[![donatj](https://avatars.githubusercontent.com/u/133747?v=4)](https://github.com/donatj "donatj (288 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (10 commits)")

---

Tags

documentationdocumentation-toolmarkdown

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/donatj-mddoc/health.svg)

```
[![Health](https://phpackages.com/badges/donatj-mddoc/health.svg)](https://phpackages.com/packages/donatj-mddoc)
```

###  Alternatives

[league/commonmark

Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and GitHub-Flavored Markdown (GFM)

3.0k404.0M702](/packages/league-commonmark)[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M229](/packages/masterminds-html5)[sabberworm/php-css-parser

Parser for CSS Files written in PHP

1.8k191.2M65](/packages/sabberworm-php-css-parser)[jms/metadata

Class/method/property metadata management in PHP

1.8k152.8M88](/packages/jms-metadata)[jms/serializer-bundle

Allows you to easily serialize, and deserialize data of any complexity

1.8k89.3M627](/packages/jms-serializer-bundle)[meyfa/php-svg

Read, edit, write, and render SVG files with PHP

54613.9M42](/packages/meyfa-php-svg)

PHPackages © 2026

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