PHPackages                             adrenalinkin/swagger-resolver-bundle - 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. [API Development](/categories/api)
4. /
5. adrenalinkin/swagger-resolver-bundle

ActiveSymfony-bundle[API Development](/categories/api)

adrenalinkin/swagger-resolver-bundle
====================================

Provides possibility for validate data according to Swagger documentation

v1.0.0(3y ago)1013.3k7[8 issues](https://github.com/adrenalinkin/swagger-resolver-bundle/issues)[2 PRs](https://github.com/adrenalinkin/swagger-resolver-bundle/pulls)MITPHPPHP ^7.1 || ^8.0

Since Aug 27Pushed 3y ago2 watchersCompare

[ Source](https://github.com/adrenalinkin/swagger-resolver-bundle)[ Packagist](https://packagist.org/packages/adrenalinkin/swagger-resolver-bundle)[ RSS](/packages/adrenalinkin-swagger-resolver-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (16)Versions (17)Used By (0)

Swagger Resolver Bundle [![На Русском](https://camo.githubusercontent.com/feb4c9ee227a5ee3a5d4e83a8a5b888b2e4b666d6cc2fb985c3bf404f8f271ac/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2544302539462544302542352544312538302544302542352544302542392544312538322544302542385f2544302542442544302542302d2544302541302544312538332544312538312544312538312544302542412544302542382544302542392d677265656e2e7376673f7374796c653d666c61742d737175617265)](./README.RU.md)
===================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#swagger-resolver-bundle-)

[![PHPUnit](https://github.com/adrenalinkin/swagger-resolver-bundle/workflows/UnitTests/badge.svg)](https://github.com/adrenalinkin/swagger-resolver-bundle/actions/workflows/unit-tests.yml)[![Coverage Status](https://camo.githubusercontent.com/0ad9b57f35b402b8a9ae6a792b9a3a74d12a8fb6c9a8065e6e3cfbae2faec80b/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f616472656e616c696e6b696e2f737761676765722d7265736f6c7665722d62756e646c652f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/adrenalinkin/swagger-resolver-bundle?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/a867a958cbe9cf28d9c828a232355be33558c7429c6421d11790f22ceccda8ad/68747470733a2f2f706f7365722e707567782e6f72672f616472656e616c696e6b696e2f737761676765722d7265736f6c7665722d62756e646c652f762f737461626c65)](https://packagist.org/packages/adrenalinkin/swagger-resolver-bundle)[![Total Downloads](https://camo.githubusercontent.com/22096d83de97f4138ecb70808d6e04537e23d4fdda4139783ec671e5ced29c31/68747470733a2f2f706f7365722e707567782e6f72672f616472656e616c696e6b696e2f737761676765722d7265736f6c7665722d62756e646c652f646f776e6c6f616473)](https://packagist.org/packages/adrenalinkin/swagger-resolver-bundle)

Feel free to connect with me by [email](mailto:adrenalinkin@gmail.com)or in [Telegram](https://t.me/adrenaL1nkin).

Usage example on [GitHub Gist](https://gist.github.com/adrenalinkin/f5cddf1afea865a3b91ac078a1cb8337#file-instruction-md)

Introduction
------------

[](#introduction)

Bundle provides possibility for validate data according to the Swagger 2 documentation. You describe your API documentation by Swagger and provides verification of data for compliance with the described requirements. When documentation has been updated then verification will be updated too, all in one place!

**Documentation is cached** through the standard `Symfony Warmers` mechanism. In debug mode, the cache automatically warms up if you change the file containing the description of the documentation.

*Note:* as result bundle returns `SwaggerResolver` object - extension for the [OptionsResolver](https://github.com/symfony/options-resolver). In this way you get full control over created resolver.

*Attention:* remember, when you change generated `SwaggerResolver` object you risk getting divergence with actual documentation.

### Integrations

[](#integrations)

Bundle provides integration with [NelmioApiDocBundle](https://github.com/nelmio/NelmioApiDocBundle), supports configuration loading by [swagger-php](https://github.com/zircote/swagger-php) and also supports loading directly from the `json` or `yaml`(`yml`) configuration file. When used default bundle configuration then swagger documentation will be load in most optimal available way. Loaders priority:

1. `NelmioApiDocBundle` - do not require any additional configuration.
2. `swagger-php` - scan `src/` directory by default. Uses `swagger_php.scan` and `swagger_php.exclude` parameters.
3. `json` - looking for `web/swagger.json` by default. Uses `configuration_file` parameter.

Installation
------------

[](#installation)

### Step 1: Download the Bundle

[](#step-1-download-the-bundle)

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

```
    composer require adrenalinkin/swagger-resolver-bundle
```

*is command requires you to have [Composer](https://getcomposer.org) install globally.*

### Step 2: Enable the Bundle

[](#step-2-enable-the-bundle)

Then, enable the bundle by updating your `app/AppKernel.php` file to enable the bundle:

```
