Skip to content

Instantly share code, notes, and snippets.

@manchan
Created October 6, 2015 00:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manchan/e5ba1bd6b465d2d020d7 to your computer and use it in GitHub Desktop.
Save manchan/e5ba1bd6b465d2d020d7 to your computer and use it in GitHub Desktop.
PHPでのAPIドキュメント作成ツール(RESTful APIとソースコードドキュメント生成) ref: http://qiita.com/you_matz/items/fa6f1691dcfec7aeac1b
#生成
apidoc -i fuel/app -f ".*\\.php$" -o public/apidoc/
{
"name": "example",
"version": "0.1.0",
"description": "apiDoc basic example",
"title": "Custom apiDoc browser title",
"url" : "https://api.github.com/v1"
}
/**
* @api {post} /user/:id ユーザー取得
* @apiVersion 0.1.0
* @apiName ユーザー取得
* @apiGroup User
*
* @apiParam {Number} id ユーザーのユニークID.
*
* @apiSuccess {String} firstname 名前.
* @apiSuccess {String} lastname 苗字.
*
* @apiSuccessExample Success-Response:
* HTTP/1.1 200 OK
* {
* "firstname": "John",
* "lastname": "Doe"
* }
*
* @apiError UserNotFound ユーザーが見つからないとき.
*
* @apiErrorExample Error-Response:
* HTTP/1.1 404 Not Found
* {
* "error": "UserNotFound"
* }
*/
function getUser(id) {
// dummy
return "ユーザー情報";
}
wget http://apigen.org/apigen.phar
chmod +x apigen.phar
mv apigen.phar /usr/local/bin/apigen
apigen --version
# get help for generate command
apigen generate --help
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment