GithubHelp home page GithubHelp logo

vishub / yii2-apidoc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yiisoft/yii2-apidoc

0.0 1.0 0.0 478 KB

Yii 2 apidoc extension.

Home Page: http://www.yiiframework.com

License: Other

PHP 96.34% Batchfile 0.31% Makefile 0.17% TeX 3.18%

yii2-apidoc's Introduction

API documentation generator for Yii 2

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

For license information check the LICENSE-file.

Latest Stable Version Total Downloads

Installation

The preferred way to install this extension is through composer.

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.0.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

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 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.

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

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

We have a special Syntax for linking to classes in the API documentation. See the code style guide for details.

Creating your own templates

TDB

Using the model layer

TDB

yii2-apidoc's People

Contributors

alexgx avatar bazilio91 avatar cebe avatar cedricyii avatar creocoder avatar cuileon avatar jom avatar lucianobaraglia avatar mickgeek avatar mohorev avatar nineinchnick avatar qiangxue avatar samdark avatar schmunk42 avatar silverfire avatar sonicgd avatar tom-- avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.