Download the PHP package luispabon/swagger-validator without Composer

On this page you can find all versions of the php package luispabon/swagger-validator. 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-validator

Note:

This is a fork of WakeOnWeb's swagger validation component. It is a pretty good package, but fairly limited and very slow moving - it probably was made to serve the needs of WakeOnWeb's projects.

I intend to push this forward without the limitations of requiring upstream approval as there are many gaps in functionality and test coverage. This will be for v2.x.

Roadmap:

* Version 1.0.x (up to 1.0.4) is essentially the same as WakeOnWeb's.
* Version 1.1.x will contain any fixes beyond WakeOnWeb
* Version 2.0.x will go well beyond the original library with OA3 support, framework integrations etc

Original README:

WakeOnWeb Swagger Validation Component Build Status

The WakeOnWeb Swagger Validation Component is an extensible component for validating API data using the Swagger - OpenAPI specification. The component supports both YAML and JSON Open API file formats. The component has very a small dependency set in order to be usable in different PHP frameworks.

The component uses:

Installation

The component can easily be installaed using

composer require wakeonweb/swagger

The component uses a JSON Schema validator, by default, the justinrainbow/json-schema is in the dev dependencies. If you intend to use the component in production you need to execute:

composer require justinrainbow/json-schema

Loading an OpenAPI specification file

The component supports both YAML and JSON OpenAPI format. Swagger files are loaded by the SwaggerFactory. The factory accepts a PSR-6 CacheItemPoolInterface. If none provided it will use the ArrayCachePool provided by cache/array-adapter.

Executing this code will result in retrieving a tree representation of the specification into an instance of a Swagger document. At the moment, the cache contains the instance of the Swagger document.

Creating the a content validator

Content validation in the component is based on JSON Schema Validation. The OpenAPI Specification handles much more than this. For example it allows to define query string parameters or the format of any HTTP Headers. The component supports all kind of validation.

Content validators are used to validate the content of a request or a response. Any content validator must implement the ContentValidatorInterface and should be registered into an instance of a ContentValidator. The resulting instance can be used into an instance of a SwaggerValidator.

Validating a response

Validating response makes sense only for testing... As you are supposed to have valid code respectfull of your interface agreements in production!

Validating a request

Validating response makes sense only for testing... As you are supposed to have valid code respectfull of your interface agreements in production!

Complete sample

The following sample code demonstrates a complete usage of the component.


All versions of swagger-validator with dependencies

PHP Build Version
Package Version
Requires psr/cache Version ~1.0
psr/http-message Version ~1.0
cache/array-adapter Version ~0.4
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 luispabon/swagger-validator contains the following files

Loading the files please wait ....