Skip to content

Commit 7654f56

Browse files
committed
Create README.md
1 parent 919625f commit 7654f56

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

README.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# yii2-apidoc-generator
2+
Yii2 Apidoc.js generator
3+
4+
Yii2 Apidoc.js generator is a little helper that generate Apidoc.js comments for your yii2 RESTFul API actions on-demand.
5+
Just call your API's endpoints to generate the comment files. Then run apidoc scripts to generate your documentation.
6+
7+
8+
PREREQUISITES
9+
-------------
10+
11+
Install Apidoc.js (http://apidocjs.com/)
12+
13+
```
14+
npm install apidoc -g
15+
```
16+
17+
18+
INSTALL APIDOC GENERATOR WITH COMPOSER
19+
---------------------------------------
20+
21+
```
22+
"eold/yii2-apidoc-generator": "^1.0."
23+
```
24+
25+
26+
CONFIGURE
27+
---------
28+
29+
Put apidoc-generator in your Yii2 config file components
30+
31+
```
32+
'docGenerator' =>[
33+
'class' => 'eold\apidocgen\src\ApiDocGenerator',
34+
'isActive'=>true, // Flag to set plugin active
35+
'versionRegexFind'=>'/(\w+)(\d+)/i', // regex used in preg_replace function to find Yii api version format (usually 'v1', 'vX') ...
36+
'versionRegexReplace'=>'${2}.0.0', // .. and replace it in Apidoc format (usually 'x.x.x')
37+
'docDataAlias'=>'@runtime/data_path' // Folder to save output. make sure is writable.
38+
],
39+
```
40+
41+
Then, add apidoc-generator in bootstrap section
42+
43+
```
44+
'bootstrap' => ['log', 'v1', 'docGenerator'],
45+
```
46+
47+
USAGE
48+
---------
49+
50+
Everytime you call an endpoint of your API's, ApiDocGenerator try to writes the corresponding Apidoc.js comment file.
51+
If an output file was already generated it will NOT be overwrited. You have to delete it and call the endpoint again.
52+
53+
Then, you have to call Apidoc.js to generate the doc
54+
55+
```
56+
apidoc -i <PATH_TO_YII2_APIDOC_GENERATOR_DATA_ALIAS> -o <PATH_TO_YOUR_GENERATED_DOCS>
57+
```
58+
59+
60+
61+
62+
63+
64+
65+
66+
67+

0 commit comments

Comments
 (0)