2017 © Pedro Peláez
 

yii2-extension yii2-apidoc

API Documentation generator for the Yii framework 2.0

image

biaoqianwo/yii2-apidoc

API Documentation generator for the Yii framework 2.0

  • Tuesday, May 15, 2018
  • by biaoqianwo
  • Repository
  • 0 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 87 Forks
  • 0 Open issues
  • 14 Versions
  • 0 % Grown

The README.md

, (*1)

API documentation generator for Yii 2


This extension provides an API documentation generator for the Yii framework 2.0., (*2)

For license information check the LICENSE-file., (*3)

Latest Stable Version Total Downloads Build Status, (*4)

Installation

The preferred way to install this extension is through composer., (*5)

Either run, (*6)

composer require --prefer-dist biaoqianwo/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:, (*7)

"biaoqianwo/yii2-apidoc": "~2.1.3"

afterwards run composer update. You may also run composer update biaoqianwo/yii2-apidoc cebe/markdown if you want to avoid updating unrelated packages., (*8)

Usage

This extension offers two commands:, (*9)

  • 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:, (*10)

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

Simple usage for stand alone guide documentation:, (*11)

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

You can combine them to generate class API and guide documentation in one place:, (*12)

# 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., (*13)

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., (*14)

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:, (*15)

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

This will read the source files from ./vendor/biaoqianwo/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)., (*16)

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):, (*17)

#!/bin/sh

# set these paths to match your environment
YII_PATH=~/dev/biaoqianwo/yii2
APIDOC_PATH=~/dev/biaoqianwo/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

You need pdflatex and GNU make for this., (*18)

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., (*19)

Special Markdown Syntax

We have a special Syntax for linking to classes in the API documentation. See the code style guide for details., (*20)

Creating your own templates

TBD, (*21)

Using the model layer

TBD, (*22)

The Versions

13/04 2014

2.0.0-beta

2.0.0.0-beta

API Documentation generator for the Yii framework 2.0

  Sources   Download

BSD-3-Clause

The Requires

 

api yii2 documentation phpdoc apidoc