Skip to content
This repository has been archived by the owner on Apr 26, 2020. It is now read-only.

An online document library used by Yii2 framework.

Notifications You must be signed in to change notification settings

coder-liyang/yii2-doc-online

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Home page

http://www.liyangweb.com

How to install?

composer require kaopur/yii2-doc-online

How to use?

  1. Install the library.
  2. Create a new module config to web.php like this:
    'modules' => [
        'doconline' => [
            'class' => 'Kaopur\yii2_doc_online\Module',
            'defaultRoute' => 'index', //默认控制器
            'appControllers' => true, //是否检测app\controllers命名空间下的控制器
            'suffix' => '', //api后缀
            'prefix' => '', //api前缀
            'modules' => [  //需要生成文档的模块命名空间
                'app\modules\admin\Module',
            ],
        ],
    ],
    
  3. Open the url from you browser. http://url.com?r=doconline

Example

The code like this:

/**
 * 这是一个测试的Api
 * @desc 列举所有的注释格式
 * @param string $user_type |用户类型|yes|其他说明|
 * @param int $sex |性别|no|0:不限 1:男 2:女|
 * @return int status 操作码,0表示成功
 * @return array list 用户列表
 * @return int list[].id 用户ID
 * @return string list[].name 用户名字
 * @return string msg 提示信息
 * @exception 400 参数传递错误
 * @exception 500 服务器内部错误
 */
public function actionDemoapi($user_type, $sex)
{
    $result = [
        'status' => 0,
        'list' => [
            'id' => 1,
            'name' => 'kaopur'
        ],
        'msg' => 'OK'
    ];
    return \yii\helpers\Json::encode($result);
}

Show

image