PHPackages                             primasoftware/swagger-php - 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. primasoftware/swagger-php

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

primasoftware/swagger-php
=========================

swagger-php - Generate interactive documentation for your RESTful API using phpdoc annotations

3.1.1(6y ago)04Apache-2.0PHPPHP &gt;=7.2

Since Apr 1Pushed 6y agoCompare

[ Source](https://github.com/cdomigan/swagger-php)[ Packagist](https://packagist.org/packages/primasoftware/swagger-php)[ Docs](https://github.com/zircote/swagger-php/)[ RSS](/packages/primasoftware-swagger-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (6)Versions (48)Used By (0)

[![Build Status](https://camo.githubusercontent.com/fb22ed6e5da8cbe2a53cd47545d607b606199be1b349c9928862c2c4f6772753/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7a6972636f74652f737761676765722d7068702f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/zircote/swagger-php)[![Total Downloads](https://camo.githubusercontent.com/2afe22c8f1ef1afa1f6bf3bcbd1698a7c018f8c1f6e6d37854e5b765cea693ba/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7a6972636f74652f737761676765722d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/zircote/swagger-php)[![License](https://camo.githubusercontent.com/b89cba305c99c2dfde6231572de7b70bd58c854ee6ca8c2b6c8b1a92a51d6426/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d417061636865322e302d626c75652e7376673f7374796c653d666c61742d737175617265)](LICENSE-2.0.txt)

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

[](#swagger-php)

Generate interactive [OpenAPI](https://www.openapis.org) documentation for your RESTful API using [doctrine annotations](https://www.doctrine-project.org/projects/doctrine-annotations/en/latest/index.html).

Features
--------

[](#features)

- Compatible with the OpenAPI 3.0 specification.
- Extracts information from code &amp; existing phpdoc annotations.
- Command-line interface available.
- [Documentation site](http://zircote.com/swagger-php/) with a getting started guide.
- Exceptional error reporting (with hints, context)

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

[](#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 `openapi` executable can be located by your system.

```
composer global require zircote/swagger-php
```

Usage
-----

[](#usage)

Add annotations to your php files.

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

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

Visit the [Documentation website](http://zircote.com/swagger-php/) for the [Getting started guide](http://zircote.com/swagger-php/Getting-started.html) or look at the [Examples directory](Examples/) for more examples.

### Usage from php

[](#usage-from-php)

Generate always-up-to-date documentation.

```
