Download the PHP package zircote/swagger-php without Composer
On this page you can find all versions of the php package zircote/swagger-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
More information about zircote/swagger-php
Files in zircote/swagger-php
Rated 4.86 based on 37 reviews
Informations about the package swagger-php
Generate interactive OpenAPI documentation for your RESTful API using
doctrine annotations (optional as of version 4.8; if required the
doctrine/annotations library must be installed in addition to swagger.php).
or PHP attributes.
For a full list of supported annotations, please have look at the documentation website.
- Compatible with the OpenAPI 3.0 and 3.1 specification.
- Extracts information from code & existing phpdoc annotations.
- Command-line interface available.
- Documentation site with a getting started guide.
- Exceptional error reporting (with hints, context)
- As of PHP 8.1 all annotations are also available as PHP attributes
OpenAPI version support
swagger-php allows to generate specs either for OpenAPI 3.0.0 or OpenAPI 3.1.0.
By default the spec will be in version
3.0.0. The command line option
--version may be used to change this
Programmatically, the method
Generator::setVersion() can be used to change the version.
swagger-php requires at least PHP 7.2 for annotations and PHP 8.1 for using attributes.
Installation (with Composer)
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.
As of version
4.8 the doctrine annotations library is optional and no longer installed by default.
To use PHPDoc annotations this needs to be installed on top of
If your code uses PHPDoc annotations you will need to install this as well:
Add annotations to your php files.
Usage from php
Generate always-up-to-date documentation.
Documentation of how to use the
Generator class can be found in the Generator reference.
Usage from the Command Line Interface
openapi command line interface can be used to generate the documentation to a static yaml/json file.
Starting with version 4 the default analyser used on the command line is the new
--legacy flag (
-l) the legacy
TokenAnalyser can still be used.
Usage from the Deserializer
Generate the OpenApi annotation object from a json string, which makes it easier to manipulate objects programmatically.