Download the PHP package radebatz/silex2swagger without Composer
On this page you can find all versions of the php package radebatz/silex2swagger. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download radebatz/silex2swagger
More information about radebatz/silex2swagger
Files in radebatz/silex2swagger
Package silex2swagger
Short Description Generate swagger documentation from Silex Annotations
License MIT
Homepage http://radebatz.net/mano/
Informations about the package silex2swagger
Bridge to generate swagger documentation from Silex Annotations
Introduction
Silex Annotations are an easy way to configure routes in Silex. With this bridge, in combination with Swagger-PHP, it is easy to generate basic swagger documentation from these annotations.
Typically the Swagger annotations are added on top of existing Silex annotations to complement/complete the definitions.
For OpenApi 3.0 and support for other frameworks use radebatz/openapi-router
Mixing Silex and Swagger annotations
``
Attaching Swagger properties to a Silex `
Silex2Swagger provides a custom annotation that allows to attach any supported Swagger property to a request. All that is required is to use a custom implementation of the Silex
annotation.
``
Setting up common parameters/responses within a Controller
If you have parameters required on all endpoints in a controller it is possible to define those on controller level to avoid code duplication.
In order to do this there is a custom ` annotation class that allows nested swagger parameters. All parameters defined that way will be injected into all routes inside the controller class.
``
Generating Swagger
Using the CL
`
Using (simple) code
``
For a more complete example have a look at the included Symfony Console command.
Gotchas
- All annotation classes need to be in the class path (visible by the auto loader).
- In order to accurately merge/group annotations it is necessary to use the
@SLX\Route
Example: ``
Changelog
v1.0.0
- Initial version
v1.0.1
- Make command more customizable
v1.0.2
- Add support for Bind annotation (set as operationId)
- Allow to auto generate description and/or summary if not present
v1.0.3
- Support callback to collect additional (custom) data to be added (ie: tags, etc.)
v2.0.0
- Update dependencies for Silex 2
v2.0.1
- Update dependencies for ddesrosiers/silex-annotation-provider to the official 2.0 version
v2.0.2
- Fix double slash being created using ` without a prefix
v3.0.0
- Introduce unique namespace and cleanup
- Add custom Swagger-PHP Request annotation that supports all swagger properties
- Bump PHP requirements to PHP 5.6
v3.0.1
- Fix bug where controller classes need to be compared using FQCN
- Allow to share parameters and responses within a controller [#9]
v3.0.2
- Allow to set all public request properties via @S2S\SwaggerProperty [#12]
v3.0.3
- Allow to specify multiple source locations on command line [#14]
v3.0.4
- Finally merge auto-generated and annotated parameter definitions [#16]
v3.0.5
- Code cleanup
All versions of silex2swagger with dependencies
ddesrosiers/silex-annotation-provider Version ~2.0
zircote/swagger-php Version ~2.0
psr/log Version ^1.0