Generate documentation for PHP API with Annotations. No dependency. No framework required.
- Preview
- Requirements
- Installation
- Usage
- Options
- Annotations
- Custom output html
- Known issues
- Acknowledgment
You can see a sample generated documentation based on class Client on http://zckrs.github.io/php-gen-doc-api/
No dependency. No framework required. View on Packagist.org
You just need PHP >= 5.3.2.
The recommended installation is via composer. Just add the following line to your composer.json :
{
...
"require": {
...
"zckrs/php-gen-doc-api": "@dev"
}
}$ php composer.phar update- Duplicate the genDocApi.php file in your project root for example.
- Set options in this new file.
- Execute it via CLI :
php genDocApi.php - You get a new HTML file. (With default options stored in web/index.html)
The name of the generated file (default : index.html).
The directory to store the html file (default : /web).
The directory to store the views (default : /src/Resources/views).
You can override view. See how to custom output HTML
The directory to store the assets (default : /src/Resources/assets).
You can override asset. See how to custom output HTML
- @ApiDescription(section="...", description="...")
- @ApiMethod(type="(get|post|put|delete")
- @ApiRoute(name="...")
- @ApiParams(name="...", type="...", nullable=(true|false), description="...", sample="...")
- @ApiReturnRootSample(sample="{ ... }")
- @ApiReturnObject(section="...", name="...", type="...", desc="...", note="...", link="...")
What includes in default layout.html :
- Bootstrap v3.1.1
- jQuery v1.10.2
- Google Code Prettify
- Create a main directory for views.
- Define option
template_diringenDocApi.php. - Put custom view with same model tree. Details Views
- Each view contains some
{{ variables }}
If you have some problems or improvements, contact me via GitHub.
This project is inspired by Calinrada's php-apidoc based on Swagger and use Extractor.php written by Eriknyk
