A php swagger annotation and parsing library
PHP
Clone or download
Pull request Compare This branch is 5 commits ahead, 197 commits behind zircote:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Examples
bin
docs
src
tests
.gitignore
.travis.yml
1.0-api.json
1.1-api.json
1.3-api.json
1.4-api.json
Changelog.md
LICENSE-2.0.txt
Readme.md
VERSION
composer.json
phpunit.xml.dist

Readme.md

swagger-php

Build Status master

Generate interactive Swagger documentation for your RESTful API using doctrine annotations.

Features

  • Compatible with the Swagger 2.0 specification.
  • Exceptional error reporting (with hints, context)
  • Extracts information from code & existing phpdoc annotations.
  • Command-line interface available.

Installation (with Composer)

composer require zircote/swagger-php

For cli usage from anywhere install swagger-php globally and make sure to place the ~/.composer/vendor/bin directory in your PATH so the swagger executable can be located by your system.

composer global require zircote/swagger-php

Usage

Add annotations to your php files.

/**
 * @SWG\Info(title="My First API", version="0.1")
 */

/**
 * @SWG\Get(
 *     path="/api/resource.json",
 *     @SWG\Response(name="200", description="An example resource")
 * )
 */

See the Examples directory for more.

Usage from php

Generate always-up-to-date the swagger documentation dynamicly.

<?php
require("vendor/autoload.php");
$swagger = \Swagger\scan('/path/to/project');
header('Content-Type: application/json');
echo $swagger;

Usage from the Command Line Interface

Generate the swagger documentation to a static json file.

./vendor/bin/swagger --help

More on Swagger

Contributing

Please feel free to submit Github Issues or pull requests. The documentation website resides within the gh-pages branch.

Bitdeli Badge