PHPackages                             sonrac/swagger-php-openapi - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. sonrac/swagger-php-openapi

ActiveLibrary[HTTP &amp; Networking](/categories/http)

sonrac/swagger-php-openapi
==========================

Swagger-PHP - Generate interactive documentation for your RESTful API using phpdoc annotations

3.0.0(7y ago)116Apache-2.0PHPPHP &gt;=7.0

Since Jun 6Pushed 7y ago1 watchersCompare

[ Source](https://github.com/sonrac/swagger-php-openapi)[ Packagist](https://packagist.org/packages/sonrac/swagger-php-openapi)[ Docs](https://github.com/zircote/swagger-php/)[ RSS](/packages/sonrac-swagger-php-openapi/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (5)Versions (3)Used By (0)

[![Build Status](https://camo.githubusercontent.com/0a96b9e678f9d205515453e3ae549db2c8010bf3e4a714e5ea70306741d14715/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f736f6e7261632f737761676765722d7068702d6f70656e6170692f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/sonrac/swagger-php-openapi)[![Total Downloads](https://camo.githubusercontent.com/fa93c5832eb641e1a152a8405b12e5e6a9edcf09a2a30e4a50194196816091e8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736f6e7261632f737761676765722d7068702d6f70656e6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sonrac/swagger-php-openapi)[![License](https://camo.githubusercontent.com/8b1aae4e936f349d6f8decdc91e35dacf277cce786deeca9364b210a029d2667/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4170616368652d626c75652e7376673f7374796c653d666c61742d737175617265)](LICENSE-2.0.txt)

swagger-php
===========

[](#swagger-php)

Generate interactive [OpenAPI](https://www.openapis.org) documentation for your RESTful API using [doctrine annotations](http://doctrine-common.readthedocs.org/en/latest/reference/annotations.html).

Features
--------

[](#features)

- Compatible with the OpenAPI 3.0 specification.
- Exceptional error reporting (with hints, context)
- Extracts information from code &amp; existing phpdoc annotations.
- Command-line interface available.

Installation (with [Composer](https://getcomposer.org))
-------------------------------------------------------

[](#installation-with-composer)

```
composer require sonrac/swagger-php-openapi
```

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 sonrac/swagger-php-openapi
```

Usage
-----

[](#usage)

Add annotations to your php files.

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

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

See the [Getting started guide](docs/Getting-started.md) and [Examples directory](Examples/) for more examples.

### Usage from php

[](#usage-from-php)

Generate always-up-to-date documentation.

```
