PHPackages                             radebatz/openapi-verifier - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. radebatz/openapi-verifier

ActiveLibrary[Testing &amp; Quality](/categories/testing)

radebatz/openapi-verifier
=========================

Verify JSON (api response) against OpenAPI specification.

2.2.1(4mo ago)9153.0k—7.8%2MITPHPPHP &gt;=8.1CI passing

Since Jun 14Pushed 2mo agoCompare

[ Source](https://github.com/DerManoMann/openapi-verifier)[ Packagist](https://packagist.org/packages/radebatz/openapi-verifier)[ Docs](http://radebatz.net/mano/)[ RSS](/packages/radebatz-openapi-verifier/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (9)Dependencies (11)Versions (14)Used By (0)

openapi-verifier
================

[](#openapi-verifier)

[![build](https://github.com/DerManoMann/openapi-verifier/actions/workflows/build.yml/badge.svg)](https://github.com/DerManoMann/openapi-verifier/actions/workflows/build.yml)[![Coverage Status](https://camo.githubusercontent.com/47c01d51f2cedccb5b63a9b22b88bc85391a773c468aff9714caf216c9915f92/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f4465724d616e6f4d616e6e2f6f70656e6170692d76657269666965722f62616467652e737667)](https://coveralls.io/github/DerManoMann/openapi-verifier)[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://opensource.org/licenses/MIT)

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

[](#introduction)

Allows to validate a controller response from your API project against a given [OpenAPI](https://www.openapis.org/)specification.

Requirements
------------

[](#requirements)

- [PHP 8.1 or higher](http://www.php.net/)

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

[](#installation)

You can use **composer** or simply **download the release**.

**Composer**

The preferred method is via [composer](https://getcomposer.org). Follow the [installation instructions](https://getcomposer.org/doc/00-intro.md) if you do not already have composer installed.

Once composer is installed, execute the following command in your project root to install this library:

```
composer require radebatz/openapi-verifier
```

After that all required classes should be availabe in your project to add routing support.

Usage
-----

[](#usage)

### Manual verification

[](#manual-verification)

The `VerifiesOpenApi` trait can be used directly and customized in 3 ways in order to provide the reqired OpenApi specifications:

- Overriding the method `getOpenApiSpecificationLoader()` as shown below
- Populating the `$openapiSpecificationLoader` property.
- Setting a property `$openapiSpecification` pointing to the specification file

```
