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

dev-master 2017-03-16 02:40 UTC

This package is auto-updated.

Last update: 2024-04-21 18:51:34 UTC


README

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.