Updated documentation

Added a screenshot to show parameters
This commit is contained in:
William DURAND 2012-04-12 19:42:53 +02:00
parent 869b8ddae9
commit 9eab1452c5
2 changed files with 14 additions and 3 deletions

View File

@ -1,6 +1,9 @@
NelmioApiDocBundle NelmioApiDocBundle
================== ==================
The **NelmioApiDocBundle** bundle allows you to generate a decent documentation for your APIs.
## Installation ## ## Installation ##
Register the namespace in `app/autoload.php`: Register the namespace in `app/autoload.php`:
@ -37,7 +40,10 @@ Enable the bundle's configuration in `app/config/config.yml`:
## Usage ## ## Usage ##
### ApiDoc() annotation ### The main problem with documentation is to keep it up to date. That's why the **NelmioApiDocBundle**
uses introspection a lot. Thanks to an annotation, it's really easy to document an API method.
### The ApiDoc() annotation ###
The bundle provides an `ApiDoc()` annotation for your controllers: The bundle provides an `ApiDoc()` annotation for your controllers:
@ -84,15 +90,18 @@ The following parameters are recognized:
* `formType`: the Form Type associated to the method, useful for POST|PUT methods. * `formType`: the Form Type associated to the method, useful for POST|PUT methods.
Each _filter_ has to define a `name` parameter, but other parameters are free. Each _filter_ has to define a `name` parameter, but other parameters are free. Filters are often optional
parameters, and you can document them as you want, but keep in mind to be consistent for the whole documentation.
If you set a `formType`, then the bundle automatically extracts parameters based on the given type, If you set a `formType`, then the bundle automatically extracts parameters based on the given type,
and determines for each parameter its data type, and if it's required or not. and determines for each parameter its data type, and if it's required or not.
The bundle will also get information from the routing definition (`requirements`, `pattern`, etc).
### Documentation on-the-fly ### ### Documentation on-the-fly ###
By adding `_doc=1` to an URL, you will get the corresponding documentation if available. By calling an URL with the parameter `_doc=1`, you will get the corresponding documentation if available.
### Web Interface ### ### Web Interface ###
@ -101,6 +110,8 @@ You can browse the whole documentation at: `http://yourproject/api/doc`.
![](https://github.com/nelmio/NelmioApiDocBundle/raw/master/Resources/doc/webview.png) ![](https://github.com/nelmio/NelmioApiDocBundle/raw/master/Resources/doc/webview.png)
![](https://github.com/nelmio/NelmioApiDocBundle/raw/master/Resources/doc/webview2.png)
### Command ### ### Command ###

BIN
Resources/doc/webview2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB