-
Notifications
You must be signed in to change notification settings - Fork 175
Auto document
cayman edited this page Jun 14, 2016
·
2 revisions
To enable Auto document, config "phprs\Router", set "export_apis" as true, then open "http://your-domain.com/apis/") to visit document.
<?php
/**
* doc class
* @path("doc_sample")
*/
class DocSample
{
/**
* doc func
* @route({"POST", "path1"}) doc path1
* @route({"POST", "path2"})
* doc path2
* @param({"arg0", "$._GET.arg0"}) doc arg0
* @param({"arg1", "$._POST.arg1"}) doc arg1
* @return({"body"}) doc return body
* @return({"status", "200 OK"}) doc return status
* @return({"header", "$header0"}) doc return $header0
* @return({"cookie", "token", "$cookie0"}) doc return $cookie0
* @throws({"Exception", "status", "500 Internal Server Error"}) doc Exception
*/
public function func($arg0, $arg1, &$header0, &$cookie0){
}
/**
* @inject("$.path[2]")
* doc common
*/
private $common;
}
Document:
Annotations can show in document:
@route
@path
@return: status,header,cookie, body,res
@throws:status,header,cookie, body,res
@param: $.path[*], $._SERVER.HTTP_X_*, $._GET.*, $._POST.*