Download the PHP package fusonic/api-documentation-bundle without Composer
On this page you can find all versions of the php package fusonic/api-documentation-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fusonic/api-documentation-bundle
More information about fusonic/api-documentation-bundle
Files in fusonic/api-documentation-bundle
Package api-documentation-bundle
Short Description Symfony bundle for automated documentation with NelmioApiDocBundle.
License MIT
Informations about the package api-documentation-bundle
fusonic-api-documentation-bundle
- About
- Install
- Usage
- Contributing
About
This bundle makes generating documentation of your (json) API routes easier. It provides a custom route annotation that can parse the input and output model of a route to generate documentation definitions for NelmioApiDocBundle. If you are using type hints for the input and output it can be detected automatically, see Usage on how to do this.
With just NelmioApiDocBundle you will often find yourself writing many annotations with a repetitive pattern. With this bundle common annotation combinations are bundled into one single route attribute.
This bundle can work well together with the http-kernel-bundle.
Install
Use composer to install the bundle from packagist.
Requirements:
- PHP 8.2+
- Symfony 5.4+
In case Symfony did not add the bundle to the bundle configuration, add the following (by default located
in config/bundles.php
):
Next you need to configure NelmioApiDocBundle.
There is one optional configuration for this bundle:
Usage
Different examples can be found in the tests.
Example route with automatic type detection
If you have some kind of response listener that allows you to return objects directly from your controller then you can use the automatic output detection based on the return type or return annotation.
If you return an array or a generic type, you can set the return type (e.g.: SomeType[]
or `SomeGeneric
Example route with manual input/output
If you do not support argument resolving and returning objects directly you can define the input
and output
classes manually.
You can also specify builtin types for the output, for example string
:
If your manually defined output is a collection, you can set outputIsCollection: true
in addition to the output
:
Contributing
This is a subtree split of fusonic/php-extensions repository. Please create your pull requests there.
All versions of api-documentation-bundle with dependencies
nelmio/api-doc-bundle Version ^4.29
symfony/config Version ^5.4 || ^6.0 || ^7.0
symfony/dependency-injection Version ^5.4 || ^6.0 || ^7.0
symfony/dom-crawler Version ^5.4 || ^6.0 || ^7.0
symfony/property-info Version ^5.4 || ^6.0 || ^7.0
symfony/routing Version ^5.4 || ^6.0 || ^7.0
zircote/swagger-php Version ^4.7