@@ -23,7 +23,56 @@ Your application is the documentation.
2323
2424``` bash
2525composer require bear/api-doc --dev
26- cp vendor/bear/api-doc/apidoc.xml.dist apidoc.xml
26+ ./vendor/bin/apidoc init
27+ ```
28+
29+ The ` init ` command generates ` apidoc.xml ` from your ` composer.json ` . Edit it to customize.
30+
31+ ``` xml
32+ <apidoc >
33+ <appName >MyVendor\MyProject</appName > <!-- Application namespace -->
34+ <scheme >app</scheme > <!-- app or page -->
35+ <docDir >docs/api</docDir >
36+ <format >html</format > <!-- html, html,openapi, etc. -->
37+ </apidoc >
38+ ```
39+
40+ The ` format ` accepts comma-separated values: ` html ` , ` md ` , ` openapi ` .
41+
42+ ## Usage
43+
44+ Generate documentation from the command line.
45+
46+ ``` bash
47+ ./vendor/bin/apidoc -capidoc.xml
48+ ```
49+
50+ ### OpenAPI HTML Generation
51+
52+ When ` openapi ` format is specified, ` openapi.json ` is generated. Use Redocly CLI to convert it to HTML.
53+
54+ ``` bash
55+ npm install -g @redocly/cli
56+ redocly build-docs docs/api/openapi/openapi.json -o docs/api/openapi/index.html
57+ ```
58+
59+ ### Composer Scripts
60+
61+ Add scripts to ` composer.json ` for convenience.
62+
63+ ``` json
64+ {
65+ "scripts" : {
66+ "docs" : " ./vendor/bin/apidoc"
67+ },
68+ "scripts-descriptions" : {
69+ "docs" : " Generate API documentation"
70+ }
71+ }
72+ ```
73+
74+ ``` bash
75+ composer docs
2776```
2877
2978## GitHub Actions
98147
99148## Profile
100149
101- [ ALPS] ( http://alps.io/ ) profile defines your API vocabulary. Centralized definitions prevent inconsistencies and aid shared understanding.
150+ ALPS profile defines your API vocabulary. Centralized definitions prevent inconsistencies and aid shared understanding.
102151
103152``` json
104153{
@@ -118,4 +167,7 @@ Code is the single source of truth. Documentation generated from your applicatio
118167
119168## Reference
120169
121- - [ ALPS] ( https://www.app-state-diagram.com/manuals/1.0/en/ )
170+ - [ BEAR.ApiDoc] ( https://github.com/bearsunday/BEAR.ApiDoc ) - API documentation generator
171+ - [ ALPS] ( https://www.app-state-diagram.com/manuals/1.0/en/ ) - Application-Level Profile Semantics
172+ - [ JSON Schema] ( https://json-schema.org/ ) - Data validation and documentation
173+ - [ Redocly CLI] ( https://redocly.com/docs/cli/installation/ ) - OpenAPI to HTML conversion
0 commit comments