davin.bao / apidoc
A sample way to scan Swagger annotation documents
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Open Issues: 0
Language:JavaScript
Requires
- php: >=5.6
- zircote/swagger-php: 2.0.9
This package is auto-updated.
Last update: 2024-10-21 20:00:41 UTC
README
apidoc
A sample way to generate Swagger documentation for your RESTful API using doctrine annotations.
Features
- Compatible with the Swagger 2.0 specification
- Support multi-apps
Installation (with Composer)
- Clone the code
- Install vendors
composer install
- Configure the host like this
vi /etc/hosts
# add IP VHOST
127.0.0.1 apidoc.local
- Configure the virtual host for Apache
<VirtualHost *:80>
ServerName apidoc.local
DocumentRoot "/www/apidoc/public"
<Directory "/www/apidoc/public">
# use mod_rewrite for pretty URL support
RewriteEngine on
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php
# use index.php as index file
DirectoryIndex index.html index.php
</Directory>
</VirtualHost>
Usage
Add annotations to your php files.
/** * @SWG\Info(title="My First API", version="0.1") */ /** * @SWG\Get( * path="/api/resource.json", * @SWG\Response(response="200", description="An example resource") * ) */
See the Examples directory for more.
Configure
- Open config/app.php
- To Config the "app-list"
- browse http://YOUR_HOST/APP_NAME, for example: http://apidoc.local/apiv1 http://apidoc.local/apiv2
More on Swagger
- http://swagger.io/
- https://github.com/swagger-api/swagger-spec/
- http://bfanger.github.io/swagger-explained/
Contributing
Feel free to submit Github Issues or pull requests.