PHPackages                             timber/teak - 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. timber/teak

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

timber/teak
===========

Generate a Markdown reference documentation for PHP projects (optimized for WordPress)

v1.4.0(2mo ago)61561[1 issues](https://github.com/timber/teak/issues)[1 PRs](https://github.com/timber/teak/pulls)3MITPHPPHP &gt;=8.1.0CI passing

Since Apr 5Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/timber/teak)[ Packagist](https://packagist.org/packages/timber/teak)[ GitHub Sponsors](https://github.com/timber)[ Fund](https://opencollective.com/timber)[ RSS](/packages/timber-teak/feed)WikiDiscussions main Synced today

READMEChangelog (10)Dependencies (9)Versions (18)Used By (3)

Teak
====

[](#teak)

Teak is a CLI utility to generate a Markdown reference documentation for PHP projects (optimized for WordPress).

It can generate documentation for

- Reference pages for your classes and global functions that follow the [WordPress PHP Documentation Standards](https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/php/)
- Reference for WordPress action and filters hooks that follow the [Inline Documentation Standards for Actions and Filters](https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/php/#4-hooks-actions-and-filters).

You can use documentation generated by Teak to create a documentation website when you use it in combination with a static site generator.

Teak is used to generate the [documentation for Timber](https://github.com/timber/docs), which uses [Hugo](http://gohugo.io/) as a static site generator.

- [Installation](#installation)
- [CLI Usage](#cli-usage)
    - [Generate a class reference](#generate-a-class-reference)
    - [Generate a function reference](#generate-a-function-reference)
    - [Generate a hook reference](#generate-a-hook-reference)
        - [Options](#options)
    - [Global CLI options](#global-cli-options)
        - [File options](#file-options)
        - [Front Matter options](#front-matter-options)
- [DocBlocks](#docblocks)
    - [Ignoring Structural Elements](#ignoring-structural-elements)
    - [Special Tags](#special-tags)
        - [@example](#example)
        - [Parameters that are arrays](#parameters-that-are-arrays)
    - [Hook Variations](#hook-variations)
- [Limitations](#limitations)
- [Contributing](#contributing)
- [Roadmap](#roadmap)

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

[](#installation)

You can install the package with Composer:

```
composer require timber/teak --dev
```

CLI Usage
---------

[](#cli-usage)

### Generate a class reference

[](#generate-a-class-reference)

When you pass a folder to the Class Reference Generator, it will generate a separate Markdown file for each class that it finds.

**Use a folder as the input**

```
vendor/bin/teak generate:class-reference ./lib/ --output ./docs/reference
```

This searches all the PHP classes in `./lib/` and outputs the Markdown files into `./docs/reference`.

**Use a single file as the input**

```
vendor/bin/teak generate:class-reference ./lib/Post.php --output ./docs/reference
```

### Generate a function reference

[](#generate-a-function-reference)

The Function Reference Generator will search all the files for global functions and output them in a single Markdown file.

```
vendor/bin/teak generate:function-reference ./lib/ --output ./docs/
```

### Generate a hook reference

[](#generate-a-hook-reference)

The Hook Reference Generator will search all the files for WordPress actions or filters and outputs one single Markdown file, with all the hooks found.

```
vendor/bin/teak generate:hook-reference ./lib --output ./docs/hooks --hook_type=filter
vendor/bin/teak generate:hook-reference ./lib --output ./docs/hooks --hook_type=action
```

#### Options

[](#options)

- `--hook_type` – The hook type to look for. Has to be either `filter` or `action`.
- `--hook_prefix` – Hook prefix (to select only hooks with a certain prefix).

### Global CLI options

[](#global-cli-options)

Display help for commands

```
vendor/bin/teak generate:class-reference -h
vendor/bin/teak generate:function-reference -h
vendor/bin/teak generate:hook-reference -h
```

#### File options

[](#file-options)

- `--file_name` – File Name (the .md extension is appended automatically)
- `--file_prefix` - File Prefix
- `--file_title` - File Title (Heading 1 in the Markdown document). Only applicable to hooks and functions reference.

#### Front Matter options

[](#front-matter-options)

Teak can generate Front Matter Blocks that you will use if you use the generated Markdown files to generate a website using a static site generator.

- `--front_matter_style` – Front Matter type. Currently, only "YAML" is supported (if not provided, will output a Heading 1 instead of a Front Matter block).

DocBlocks
---------

[](#docblocks)

Teak works best if you follow the [WordPress PHP Documentation Standards](https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/php/). Because the documentation renders to Markdown, you *can* use Markdown syntax in your DocBlocks.

### Ignoring Structural Elements

[](#ignoring-structural-elements)

An element (class, method, property) is **ignored when one of the following conditions** applies:

- No DocBlock is provided
- No `@api` tag is present
- An `@ignore` tag is present
- An `@internal` tag is present
- The visibility is `private` (applies to methods only)

This means that for Markdown files to be generated for a class at all, you’ll need at least a DocBlock, with an `@api` tag.

```
/**
 * Class My_Public_Class
 *
 * @api
 */
class My_Public_Class {}
```

### Special Tags

[](#special-tags)

#### @example

[](#example)

The `@example` tag allows you add code examples to your DocBlocks, including fenced code blocks:

```
/**
 * Function summary.
 *
 * Function description.
 *
 * @api
 * @example
 *
 * Optional text to describe the example
 *
 * ```php
 * my_method( 'example', false );
 * ```
 *
 * @param string $param1 Description. Default 'value'.
 * @param bool   $param2 Description. Default true.
 */
function my_method( $param1 = 'value', $param2 = true ) {}
```

#### @hooked

[](#hooked)

The `@hooked` tag allows you to mark which internal functions are hooked to your action.

```
/**
 * Fires in the head element of the website
 *
 * @hooked my_statistics_function - 10 (Outputs the statistics code, if enabled)
 * @hooked my_analytics_function - 11 (Outputs the analytics meta tags, if enabled)
 */
do_action('my_custom_head');
```

#### Parameters that are arrays

[](#parameters-that-are-arrays)

Teak supports [parameters that are arrays](https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/php/#1-1-parameters-that-are-arrays).

### Hook Variations

[](#hook-variations)

Sometimes you’ll have two hooks that follow each other and do basically the same, but allow you to make the hook apply only on certain conditions:

```
/**
 * Fires on a specific processing status.
 *
 * The status can be one of the following: `success`, `error` or `fail`.
 */
do_action( "myplugin/process/status/{$status}" );
do_action( "myplugin/process/status/{$status}/{$action}" );
```

In this example, you’d have a variable `$status` and an `$action`. The first action is triggered when you use it with a certain status, the second action would be triggered if you use a certain status and a certain action. Teak will list these hook variations under the same hook. Because of this, you only need to define a DocBlock for the first hook.

Limitations
-----------

[](#limitations)

This compiler is not a full implementation of phpDocumentor. Rather, it tries to make code documentation that follows the [WordPress PHP Documentation Standards](https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/php/) more readable, and less techy. Not all [official tags](https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/php/#phpdoc-tags) are considered yet.

Contributing
------------

[](#contributing)

Contributions are very welcome.

Roadmap
-------

[](#roadmap)

- CLI: accept a list of files.
- Support nested array arguments
- Add support for [Inline Tags](http://docs.phpdoc.org/references/phpdoc/inline-tags/index.html).
- Add tests.
- Optimize linking between Markdown documents.

###  Health Score

53

—

FairBetter than 96% of packages

Maintenance83

Actively maintained with recent releases

Popularity19

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 84.4% 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 ~226 days

Recently: every ~143 days

Total

14

Last Release

70d ago

PHP version history (3 changes)1.0.0PHP &gt;=7.0.0

1.0.5PHP &gt;=7.4.0

v1.1.0PHP &gt;=8.1.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2084481?v=4)[Lukas Gächter](/maintainers/gchtr)[@gchtr](https://github.com/gchtr)

---

Top Contributors

[![gchtr](https://avatars.githubusercontent.com/u/2084481?v=4)](https://github.com/gchtr "gchtr (76 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (7 commits)")[![Levdbas](https://avatars.githubusercontent.com/u/17764157?v=4)](https://github.com/Levdbas "Levdbas (6 commits)")[![jarednova](https://avatars.githubusercontent.com/u/1298086?v=4)](https://github.com/jarednova "jarednova (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/timber-teak/health.svg)

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

###  Alternatives

[friendsoftypo3/content-blocks

TYPO3 CMS Content Blocks - Content Types API | Define reusable components via YAML

101466.4k45](/packages/friendsoftypo3-content-blocks)[craftcms/cms

Craft CMS

3.6k3.6M2.9k](/packages/craftcms-cms)[phpro/soap-client

A general purpose SoapClient library

8895.9M52](/packages/phpro-soap-client)[cognesy/instructor-php

The complete AI toolkit for PHP: unified LLM API, structured outputs, agents, and coding agent control

318117.1k1](/packages/cognesy-instructor-php)[api-platform/openapi

Models to build and serialize an OpenAPI specification.

374.2M77](/packages/api-platform-openapi)[blackfire/player

A powerful web crawler and web scraper with Blackfire support

49517.1k](/packages/blackfire-player)

PHPackages © 2026

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