Download the PHP package biggold/apidoc-for-laravel without Composer
On this page you can find all versions of the php package biggold/apidoc-for-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package apidoc-for-laravel
larvel接口文档生成,测试工具生成工具
目前已经是基本可用版本,不过测试工具返回类型只有json类型
基本使用方法
- composer 安装包:
composer require biggold/apidoc-for-laravel
- 配置服务提供者, config/app.php
'providers' => [ Biggold\Apidoc\ApiDocServiceProvider::class ]
- 在controller方法上编写文档,具体编写见下面"文档编写规则"
- 生成文档(生成前会删除所有文档): php artisan doc:generate
- 查看文档: http://project-domain/docs/index.html
- 清空所有文档: php artisan doc:cleanall
基本用法生成物描述
生成物包含文档页和测试工具页,下面是截图:
文档图片:
工具图片:
文档编写方法:
基本模板
/** * @name 用户中心-登录 * @description 用户登录接口 * @param username:登录邮箱 @ParamTest [email protected] * @param password:登录密码 @ParamTest 12345678 * * @response 通用格式:{"code":响应码,"message":"错误描述","data":{}} * data{ * userid:"用户id,值为0表示用户未登录", * nickname: "用户昵称", * expired: 最后有效时间(时间戳秒),-1 * } */ public function login(Request $request){}
Route::group(['prefix' => 'auth', 'middleware'=>[], 'grouptitle'=>'用户中心'], function(){ Route::post('login','Auth\LoginController@login')->name("auth.login"); });
标签描述
标签解析规则方法注释中@开头,空格结尾,空格过后是标签内容两边的空格将去掉,内容内的@xxx将不作为标签识别,参数标签@Param做了特殊处理可以包含默认参数测试标签@ParamTest
@name
接口名称
@description
接口描述
@param
参数标签,代表http请求的参数描述,格式如下:@Param 参数名称:参数描述 @ParamTest 参数默认测试值(会自动填充到测试表单中)
@response
参数结果描述,显示时候显示在\<pre>\</pre>中保存格式
接口分组
文档中支持用户分组的,如模板中使用'grouptitle'=>'用户中心'为路由分组命名为"用户中心",这将在文档中体现,如果没有这个分组标题,将不在文档中体现分组,文档上最好是一层分组,如果有多层将一次显示,但是没有层次缩进
All versions of apidoc-for-laravel with dependencies
PHP Build Version
Package Version
Requires
php Version
>=7.1.0
composer-plugin-api Version ^1.0
composer-plugin-api Version ^1.0
The package biggold/apidoc-for-laravel contains the following files
Loading the files please wait ....