diff --git a/README.md b/README.md index b57e9afd..5bd2f057 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,10 @@ # swagger-php -Generate interactive [OpenAPI](https://www.openapis.org) documentation for your RESTful API using -[doctrine annotations](https://www.doctrine-project.org/projects/annotations.html) (optional as of version 4.8; if required the `doctrine/annotations` library must be installed in addition to swagger.php). -or [PHP attributes](https://www.php.net/manual/en/language.attributes.overview.php). +Generate interactive [OpenAPI](https://www.openapis.org) documentation for your RESTful API using [PHP attributes](https://www.php.net/manual/en/language.attributes.overview.php) (preferred) or +[doctrine annotations](https://www.doctrine-project.org/projects/annotations.html) (requires additional `doctrine/annotations` library). -For a full list of supported annotations, please have look at the [`OpenApi\Annotations` namespace](src/Annotations) or the [documentation website](https://zircote.github.io/swagger-php/guide/annotations.html). +See the [documentation website](https://zircote.github.io/swagger-php/guide/attributes.html) for supported attributes and annotations. ## Features @@ -19,6 +18,8 @@ For a full list of supported annotations, please have look at the [`OpenApi\Anno - 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**. @@ -44,9 +45,11 @@ composer global require zircote/swagger-php ``` ### doctrine/annotations + As of version `4.8` the [doctrine annotations](https://www.doctrine-project.org/projects/annotations.html) library **is optional** and **no longer installed by default**. To use PHPDoc annotations this needs to be installed on top of `swagger-php`: + ```shell composer require doctrine/annotations ``` @@ -88,6 +91,7 @@ $openapi = \OpenApi\Generator::scan(['/path/to/project']); header('Content-Type: application/x-yaml'); echo $openapi->toYaml(); ``` + Documentation of how to use the `Generator` class can be found in the [Generator reference](https://zircote.github.io/swagger-php/reference/generator). ### Usage from the Command Line Interface @@ -97,6 +101,7 @@ The `openapi` command line interface can be used to generate the documentation t ```shell ./vendor/bin/openapi --help ``` + Starting with version 4 the default analyser used on the command line is the new `ReflectionAnalyser`. Using the `--legacy` flag (`-l`) the legacy `TokenAnalyser` can still be used.