PHPackages                             zabachok/yii2-apidoc - 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. [API Development](/categories/api)
4. /
5. zabachok/yii2-apidoc

ActiveYii2-extension[API Development](/categories/api)

zabachok/yii2-apidoc
====================

API Documentation generator for the Yii framework 2.0

2.2.1(5y ago)00BSD-3-ClausePHPPHP &gt;=5.4

Since Apr 13Pushed 5y agoCompare

[ Source](https://github.com/zabachok/yii2-apidoc)[ Packagist](https://packagist.org/packages/zabachok/yii2-apidoc)[ GitHub Sponsors](https://github.com/yiisoft)[ Fund](https://opencollective.com/yiisoft)[ RSS](/packages/zabachok-yii2-apidoc/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (2)Dependencies (11)Versions (19)Used By (0)

 [ ![](https://avatars0.githubusercontent.com/u/993323) ](https://github.com/yiisoft)

API documentation generator for Yii 2
=====================================

[](#api-documentation-generator-for-yii-2)

This extension provides an API documentation generator for the [Yii framework 2.0](http://www.yiiframework.com).

For license information check the [LICENSE](LICENSE.md)-file.

[![Latest Stable Version](https://camo.githubusercontent.com/ec20075a6dbd496dfd6e4e91d82f4eb1c30a8785590d0730deacf8bd37a1e4fc/68747470733a2f2f706f7365722e707567782e6f72672f796969736f66742f796969322d617069646f632f762f737461626c652e706e67)](https://packagist.org/packages/yiisoft/yii2-apidoc)[![Total Downloads](https://camo.githubusercontent.com/18ae723036ed1976992fb05375a9152678fa2d3313c398d3f6fe8cb1eb0ff6bc/68747470733a2f2f706f7365722e707567782e6f72672f796969736f66742f796969322d617069646f632f646f776e6c6f6164732e706e67)](https://packagist.org/packages/yiisoft/yii2-apidoc)[![Build Status](https://github.com/yiisoft/yii2-apidoc/workflows/build/badge.svg)](https://github.com/yiisoft/yii2-apidoc/actions)

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
composer require --prefer-dist yiisoft/yii2-apidoc

```

The above command may not work on an existing project due to version conflicts that need to be resolved, so it is preferred to add the package manually to the require section of your composer.json:

```
"yiisoft/yii2-apidoc": "~2.1.0"
```

afterwards run `composer update`. You may also run `composer update yiisoft/yii2-apidoc cebe/markdown` if you want to avoid updating unrelated packages.

Usage
-----

[](#usage)

This extension offers two commands:

- `api` to generate class API documentation. [phpDocumentor](https://www.phpdoc.org/) is used as a base framework so refer to its guide for the syntax.
- `guide` to render nice HTML pages from markdown files such as the yii guide.

Simple usage for stand-alone class documentation:

```
vendor/bin/apidoc api source/directory ./output

```

Simple usage for stand-alone guide documentation:

```
vendor/bin/apidoc guide source/docs ./output

```

You can combine them to generate class API and guide documentation in one place:

```
# generate API docs
vendor/bin/apidoc api source/directory ./output
# generate the guide (order is important to allow the guide to link to the apidoc)
vendor/bin/apidoc guide source/docs ./output

```

By default, the `bootstrap` template will be used. You can choose a different template with the `--template=name` parameter. Currently, there is only the `bootstrap` template available.

You may also add the `yii\apidoc\commands\ApiController` and `GuideController` to your console application command map and run them inside of your applications console app.

### Generating docs from multiple sources

[](#generating-docs-from-multiple-sources)

The apidoc generator can use multiple directories, so you can generate docs for your application and include the yii framework docs to enable links between your classes and framework classes. This also allows `@inheritdoc` to work for your classes that extend from the framework. Use the following command to generate combined api docs:

```
./vendor/bin/apidoc api ./vendor/yiisoft/yii2,. docs/json --exclude="docs,vendor"

```

This will read the source files from `./vendor/yiisoft/yii2` directory and `.` which is the current directory (you may replace this with the location of your code if it is not in the current working directory).

### Advanced usage

[](#advanced-usage)

The following script can be used to generate API documentation and guide in different directories and also multiple guides in different languages (like it is done on yiiframework.com):

```
#!/bin/sh

# set these paths to match your environment
YII_PATH=~/dev/yiisoft/yii2
APIDOC_PATH=~/dev/yiisoft/yii2/extensions/apidoc
OUTPUT=yii2docs

cd $APIDOC_PATH
./apidoc api $YII_PATH/framework/,$YII_PATH/extensions $OUTPUT/api --guide=../guide-en --guidePrefix= --interactive=0
./apidoc guide $YII_PATH/docs/guide    $OUTPUT/guide-en --apiDocs=../api --guidePrefix= --interactive=0
./apidoc guide $YII_PATH/docs/guide-ru $OUTPUT/guide-ru --apiDocs=../api --guidePrefix= --interactive=0
# repeat the last line for more languages
```

### Creating a PDF of the guide

[](#creating-a-pdf-of-the-guide)

You need `pdflatex` and GNU `make` for this.

```
vendor/bin/apidoc guide source/docs ./output --template=pdf
cd ./output
make pdf

```

If all runs without errors the PDF will be `guide.pdf` in the `output` dir.

Special Markdown Syntax
-----------------------

[](#special-markdown-syntax)

We have a special Syntax for linking to classes in the API documentation. See the [code style guide](https://github.com/yiisoft/yii2/blob/master/docs/internals/core-code-style.md#markdown) for details.

Creating your own templates
---------------------------

[](#creating-your-own-templates)

TBD

Using the model layer
---------------------

[](#using-the-model-layer)

TBD

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 58.7% 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 ~143 days

Recently: every ~77 days

Total

18

Last Release

1971d ago

### Community

Maintainers

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

---

Top Contributors

[![cebe](https://avatars.githubusercontent.com/u/189796?v=4)](https://github.com/cebe "cebe (195 commits)")[![samdark](https://avatars.githubusercontent.com/u/47294?v=4)](https://github.com/samdark "samdark (55 commits)")[![qiangxue](https://avatars.githubusercontent.com/u/993322?v=4)](https://github.com/qiangxue "qiangxue (28 commits)")[![klimov-paul](https://avatars.githubusercontent.com/u/1482054?v=4)](https://github.com/klimov-paul "klimov-paul (11 commits)")[![schmunk42](https://avatars.githubusercontent.com/u/649031?v=4)](https://github.com/schmunk42 "schmunk42 (6 commits)")[![mohorev](https://avatars.githubusercontent.com/u/4974062?v=4)](https://github.com/mohorev "mohorev (6 commits)")[![zabachok](https://avatars.githubusercontent.com/u/966135?v=4)](https://github.com/zabachok "zabachok (4 commits)")[![lucianobaraglia](https://avatars.githubusercontent.com/u/374554?v=4)](https://github.com/lucianobaraglia "lucianobaraglia (3 commits)")[![brandonkelly](https://avatars.githubusercontent.com/u/47792?v=4)](https://github.com/brandonkelly "brandonkelly (3 commits)")[![machour](https://avatars.githubusercontent.com/u/304450?v=4)](https://github.com/machour "machour (2 commits)")[![rob006](https://avatars.githubusercontent.com/u/5972388?v=4)](https://github.com/rob006 "rob006 (2 commits)")[![SilverFire](https://avatars.githubusercontent.com/u/4499203?v=4)](https://github.com/SilverFire "SilverFire (2 commits)")[![tom--](https://avatars.githubusercontent.com/u/1178722?v=4)](https://github.com/tom-- "tom-- (2 commits)")[![AlexGx](https://avatars.githubusercontent.com/u/1571119?v=4)](https://github.com/AlexGx "AlexGx (1 commits)")[![mickgeek](https://avatars.githubusercontent.com/u/8091481?v=4)](https://github.com/mickgeek "mickgeek (1 commits)")[![hiqsol](https://avatars.githubusercontent.com/u/11820365?v=4)](https://github.com/hiqsol "hiqsol (1 commits)")[![nineinchnick](https://avatars.githubusercontent.com/u/795177?v=4)](https://github.com/nineinchnick "nineinchnick (1 commits)")[![cuileon](https://avatars.githubusercontent.com/u/313312?v=4)](https://github.com/cuileon "cuileon (1 commits)")[![ricpelo](https://avatars.githubusercontent.com/u/616169?v=4)](https://github.com/ricpelo "ricpelo (1 commits)")[![SonicGD](https://avatars.githubusercontent.com/u/1222013?v=4)](https://github.com/SonicGD "SonicGD (1 commits)")

---

Tags

apiphpdocdocumentationyii2apidoc

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/zabachok-yii2-apidoc/health.svg)

```
[![Health](https://phpackages.com/badges/zabachok-yii2-apidoc/health.svg)](https://phpackages.com/packages/zabachok-yii2-apidoc)
```

###  Alternatives

[yiisoft/yii2-apidoc

API Documentation generator for the Yii framework 2.0

257701.8k31](/packages/yiisoft-yii2-apidoc)[phpdocumentor/phpdocumentor

Documentation Generator for PHP

4.4k3.1M878](/packages/phpdocumentor-phpdocumentor)[knuckleswtf/scribe

Generate API documentation for humans from your Laravel codebase.✍

2.3k12.2M45](/packages/knuckleswtf-scribe)[apigen/apigen

PHP source code API generator.

2.2k627.9k225](/packages/apigen-apigen)[pronamic/wp-documentor

Documentation Generator for WordPress.

6529.8k5](/packages/pronamic-wp-documentor)[unionofrad/li3_docs

An API and wiki-like documentation generator.

1682.6k](/packages/unionofrad-li3-docs)

PHPackages © 2026

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