Skip to content

davin-bao/apidoc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Total Downloads License

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)

  1. Clone the code
  2. Install vendors
composer install
  1. Configure the host like this
vi /etc/hosts
# add IP VHOST
127.0.0.1 apidoc.local
  1. 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

  1. Open config/app.php
  2. To Config the "app-list"
  3. browse http://YOUR_HOST/APP_NAME, for example: http://apidoc.local/apiv1 http://apidoc.local/apiv2

More on Swagger

Contributing

Feel free to submit Github Issues or pull requests.

About

A sample way to scan Swagger annotation documents

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages