From 7654f56d7d666cbdf01de7e73e81f3033c2257dc Mon Sep 17 00:00:00 2001 From: Enrico Vecchio Date: Tue, 21 Jul 2015 12:35:28 +0200 Subject: [PATCH] Create README.md --- README.md | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..cf4ded8 --- /dev/null +++ b/README.md @@ -0,0 +1,67 @@ +# yii2-apidoc-generator +Yii2 Apidoc.js generator + +Yii2 Apidoc.js generator is a little helper that generate Apidoc.js comments for your yii2 RESTFul API actions on-demand. +Just call your API's endpoints to generate the comment files. Then run apidoc scripts to generate your documentation. + + +PREREQUISITES +------------- + +Install Apidoc.js (http://apidocjs.com/) + +``` +npm install apidoc -g +``` + + +INSTALL APIDOC GENERATOR WITH COMPOSER +--------------------------------------- + +``` + "eold/yii2-apidoc-generator": "^1.0." + ``` + + +CONFIGURE +--------- + +Put apidoc-generator in your Yii2 config file components + +``` +'docGenerator' =>[ + 'class' => 'eold\apidocgen\src\ApiDocGenerator', + 'isActive'=>true, // Flag to set plugin active + 'versionRegexFind'=>'/(\w+)(\d+)/i', // regex used in preg_replace function to find Yii api version format (usually 'v1', 'vX') ... + 'versionRegexReplace'=>'${2}.0.0', // .. and replace it in Apidoc format (usually 'x.x.x') + 'docDataAlias'=>'@runtime/data_path' // Folder to save output. make sure is writable. + ], +``` + +Then, add apidoc-generator in bootstrap section + +``` +'bootstrap' => ['log', 'v1', 'docGenerator'], +``` + +USAGE +--------- + +Everytime you call an endpoint of your API's, ApiDocGenerator try to writes the corresponding Apidoc.js comment file. +If an output file was already generated it will NOT be overwrited. You have to delete it and call the endpoint again. + +Then, you have to call Apidoc.js to generate the doc + +``` +apidoc -i -o +``` + + + + + + + + + +