A vital part of having an API is ensuring people can use it. This means having great documentation. To help with this, FRAPI includes a simple documentation generator for exposing your APIs details automatically.
FRAPI's automatic documentation supports extended markdown syntax, and automatic PHP syntax highlighting. It will automatically display all enabled actions, their arguments, and descriptions; as well as errors and output formats/mimetypes.
FRAPI comes with the documentation pre-installed, and available via the GET /
action (e.g. at the API root). By default, this uses the name "Introduction", and the documentation is rendered using the /custom/Output/html/Introduction.html.tpl
template. If you change the name, do not forget to move the template.
The template will automatically split out the /
action as introductory documentation. If you wish to move the documentation (e.g. to /docs
), you will have to update the template to reflect this.
To remove the documentation, simple delete the action, and the template file.
The default template uses the Action and Error descriptions, as entered into the FRAPI admin. Simple enter in plain text, or Extended Markdown, and it will display in the documentation (note: do not forget to sync your changes!).
FRAPI's documentation template understands standard markdown as well as the changes and additions implemented by PHP Markdown Extra.
Furthermore, you can also add PHP syntax highlighting in examples by using the following syntax:
```php echo "Hello World"; ```
Note: Do not include opening and closing PHP tags.