caelestis/yii2-apidoc
Composer 安装命令:
composer require caelestis/yii2-apidoc
包简介
API Documentation generator for the Yii framework 2.0
README 文档
README
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.
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.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
This extension offers two commands:
apito generate class API documentation.guideto 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
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
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
TBD
Using the model layer
TBD
caelestis/yii2-apidoc 适用场景与选型建议
caelestis/yii2-apidoc 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 47 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 07 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「documentation」 「phpdoc」 「api」 「yii2」 「apidoc」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 caelestis/yii2-apidoc 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 caelestis/yii2-apidoc 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 caelestis/yii2-apidoc 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A simple tool for checking that your PHP classes and methods use PHPDocs (PHP DocBlocks Checker fork).
Bookdown.io With Bootswatch Styles And Prism Syntax Highlighting
Laravel package that generates RESTful API documentation in Markdown based on PHPDoc.
A PSR-7 compatible library for making CRUD API endpoints
Laravel API documentation generating tool
Validates PHPDoc @param and @return tags against method signatures
统计信息
- 总下载量: 47
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2019-07-04