Download the PHP package adrenalinkin/swagger-resolver-bundle without Composer

On this page you can find all versions of the php package adrenalinkin/swagger-resolver-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package swagger-resolver-bundle

Swagger Resolver Bundle

PHPUnit Coverage Status Latest Stable Version Total Downloads

Feel free to connect with me by email or in Telegram.

Usage example on GitHub Gist

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. 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

Bundle provides integration with NelmioApiDocBundle, supports configuration loading by 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

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:

is command requires you to have Composer install globally.

Step 2: Enable the Bundle

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

Configuration

To start using bundle you don't need to define some additional configuration. All parameters have values by default:

Usage

Step 1: Swagger documentation preparation

Swagger documentation preparation differ according to used tools of your project.

NelmioApiDocBundle

If your project has NelmioApiDocBundle connected, then no additional configuration is required.

swagger-php

In the absence of NelmioApiDocBundle, the bundle will degrade to the configuration loading by swagger-php annotations. In this case, by default, will be used src/ directory to scan. To optimize scanning process you can describe directories in the configuration:

JSON

In the absence of NelmioApiDocBundle and swagger-php, the bundle will degrade to the configuration loading by json file. In this case, by default, will be used web/swagger.json file. Also, you can set custom path to the json configuration:

YAML or (yml)

In the absence of NelmioApiDocBundle and swagger-php, but available configuration file in the yaml or yml format you need to define path to that file:

Custom

If you need to use custom configuration loader you should implement custom loading process in the class, which implements SwaggerConfigurationLoaderInterface interface. After that you need to define name of that service in the configuration:

Step 2: Data validation

Validation for model

Validation for request

Advanced

Custom validator

Bundle validates the data through the validator system. List of all validators, you can find out by going to the Validator folder. All validators registered as tagging services. To create your own validator it is enough to create class, which implements SwaggerValidatorInterface and then register it under the tag linkin_swagger_resolver.validator.

Custom normalizer

Bundle validates the data through the normalizer system. List of all normalizers, you can find out by going to the Normalizer folder. All normalizers registered as tagging services. To create your own normalizer it is enough to create class, which implements SwaggerNormalizerInterface and then register it under the tag linkin_swagger_resolver.normalizer.

Running the tests and static analysis tools

Download the project:

Follow this instruction for set up simple docker container.

Install composer dependencies:

For run the test suite:

For run the PHP-CS-Fixer:

For run the composer-normalize:

License


All versions of swagger-resolver-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1 || ^8.0
ext-json Version *
exsyst/swagger Version ^0.4
symfony/config Version ^3.4 || ^4.0 || ^5.0
symfony/dependency-injection Version ^3.4 || ^4.0 || ^5.0
symfony/finder Version ^3.4 || ^4.0 || ^5.0
symfony/http-foundation Version ^3.4 || ^4.0 || ^5.0
symfony/http-kernel Version ^3.4 || ^4.0 || ^5.0
symfony/options-resolver Version ^3.4 || ^4.0 || ^5.0
symfony/routing Version ^3.4 || ^4.0 || ^5.0
symfony/yaml Version ^3.4 || ^4.0 || ^5.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package adrenalinkin/swagger-resolver-bundle contains the following files

Loading the files please wait ....