PHP code example of ibunao / yii2-apidoc

1. Go to this page and download the library: Download ibunao/yii2-apidoc 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/ */

    

ibunao / yii2-apidoc example snippets


composer 

'modules' => [
    ...
    ...
    'document' => [
        'class' => 'ibunao\apidoc\Module',
        # 配置访问接口的host  通常配置 frontend 项目的域名
        'debugHost' => 'http://api.yiidoc.com',
        # 和配置时定义的模块名一致
        'moduleName' => 'document',
    ],
    ...
    ...
],

return [
	'apiList' => [
		'test' => [
			'label' => '文档测试',
			'class' => 'frontend\controllers\ApidocController',
		],
		'test2' => [
			'label' => '文档测试2',
			'class' => 'frontend\controllers\Apidoc2Controller',
		],
	],
];

/**
 * 注册步骤一:手机号获取验证码
 *
 * @name	获取注册验证码
 * @uses	用户注册是拉取验证码
 * @method	post
 * @param	string $phone 手机号
 * @author	echoding
 */
public function actionIndex()
{
    Yii::$app->response->format = 'json';
	return Yii::$app->request->post();
}