PHP code example of badcat / yii2-api-doc

1. Go to this page and download the library: Download badcat/yii2-api-doc library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

badcat / yii2-api-doc example snippets


/**
 * @desc 后台接口
 */
class Module extends \yii\base\Module
{
    public $controllerNamespace = 'webapp\modules\adminapi\controllers';

    public function init()
    {
        parent::init();
        Yii::configure(Yii::$app, 

/**
     *
     * @desc 添加管理员
     * @method POST
     * @author lrj
     * @param $user_name | 是 | string | 用户名
     * @param $pwd | 是 | string | 密码
     * @requestEx  {"user_name":"用户名","pwd":"密码"}
     * @returnEx {"user_name":"用户名","pwd":"密码"}
     * @returnParam $user_name | string | 用户名
     * @returnParam $pwd | string | 密码
     **/
    public function actionAdd()
    {        
        return $this->result;

    }