README.md 1.67 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
API documentation generator for Yii 2
=====================================

This extension provides an API documentation generator for the Yii framework 2.0.

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

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

Either run

```
14
php composer.phar require --prefer-dist yiisoft/yii2-apidoc "*"
15 16 17 18 19
```

or add

```json
20
"yiisoft/yii2-apidoc": "*"
21 22 23 24 25 26 27
```

to the require section of your composer.json.

Usage
-----

28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
This extension offers two commands:

- `api` to generate class API documentation.
- `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 doc in one place:
Carsten Brandt committed
46 47

```
48 49 50 51 52 53
# first generate guide docs to allow links from code to guide you may skip this if you do not need these.
vendor/bin/apidoc guide source/docs ./output
# second generate API docs
vendor/bin/apidoc api source/directory ./output
# third run guide docs again to have class links enabled
vendor/bin/apidoc guide source/docs ./output
Carsten Brandt committed
54 55
```

56 57
By default the `bootstrap` template will be used. You can choose a different templates with the `--template=name` parameter.
Currently there is only the `bootstrap` template available.
Carsten Brandt committed
58 59 60

You may also add the `yii\apidoc\commands\RenderController` to your console application class map and
run it inside of your applications console app.
61 62 63 64 65 66 67 68 69

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

TDB

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

70
TDB