PHPackages                             mdc/swagger-test - 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. mdc/swagger-test

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

mdc/swagger-test
================

A set of tools for testing your REST calls based on the Swagger or OpenAPI documentation using PHPUnit

2.0.1(1y ago)0382MITPHPPHP &gt;=8.1

Since Feb 2Pushed 1y agoCompare

[ Source](https://github.com/zakima/php-swagger-test)[ Packagist](https://packagist.org/packages/mdc/swagger-test)[ RSS](/packages/mdc-swagger-test/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (3)Versions (7)Used By (0)

PHP Swagger Test
================

[](#php-swagger-test)

[![Build Status](https://github.com/byjg/php-swagger-test/actions/workflows/phpunit.yml/badge.svg?branch=master)](https://github.com/byjg/php-swagger-test/actions/workflows/phpunit.yml)[![Opensource ByJG](https://camo.githubusercontent.com/425c1bbccc0f292bf4d20569ae74a6b2e384fd648f1af8911bc61de9a8dcfc0b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6f70656e736f757263652d62796a672d737563636573732e737667)](http://opensource.byjg.com)[![GitHub source](https://camo.githubusercontent.com/88e61eb211719144efdd570290a0456b6e13099c2df8d973f1bb43fe33bf0039/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4769746875622d736f757263652d696e666f726d6174696f6e616c3f6c6f676f3d676974687562)](https://github.com/byjg/php-swagger-test/)[![GitHub license](https://camo.githubusercontent.com/7ebb861cab4df16ee54a53dd1d565b33b9b76aa8496a4194afaf3aa1b2f672ea/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f62796a672f7068702d737761676765722d746573742e737667)](https://opensource.byjg.com/opensource/licensing.html)[![GitHub release](https://camo.githubusercontent.com/2fcfb1b5d8e50b98551e969c0a375efb9bf2b901e9c9caa36dd9d8a3075be9f5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f62796a672f7068702d737761676765722d746573742e737667)](https://github.com/byjg/php-swagger-test/releases/)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/8a455d35c521c41ed4776830fc492fb2d4d5711aee2fe4ad92fde9e722c76150/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f62796a672f7068702d737761676765722d746573742f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/byjg/php-swagger-test/?branch=master)

A set of tools for testing your REST calls based on the OpenApi specification using PHPUnit. Currently, this library supports the OpenApi specifications `2.0` (formerly swagger) and `3.0`. Some features like callbacks, links and references to external documents/objects weren't implemented.

PHP Swagger Test can help you to test your REST Api. You can use this tool both for Unit Tests or Functional Tests.

This tool reads a previously Swagger JSON file (not YAML) and enables you to test the request and response. You can use the tool "" for creating the JSON file when you are developing your rest API.

The ApiTestCase's assertion process is based on throwing exceptions if some validation or test failed.

Use cases for PHP Swagger test
------------------------------

[](#use-cases-for-php-swagger-test)

You can use the Swagger Test library as:

- [Functional test cases](docs/functional-tests.md)
- [Contract test cases](docs/contract-tests.md)
- [Runtime parameters validator](docs/runtime-parameters-validator.md)
- [Mocking Requests and Validate your specification](docs/mock-requests.md)

Who is using this library?

- [ByJG PHP Rest Reference Architecture](https://github.com/byjg/php-rest-reference-architecture)
- [Laravel Swagger Test](https://github.com/pionl/laravel-swagger-test)

Install
-------

[](#install)

```
composer require "byjg/swagger-test"
```

Tests
-----

[](#tests)

```
SPEC=swagger php -S 127.0.0.1:8080 tests/rest/app.php &
SPEC=openapi php -S 127.0.0.1:8081 tests/rest/app.php &
vendor/bin/phpunit
```

Questions?
----------

[](#questions)

Please raise your issue on [Github issue](https://github.com/byjg/php-swagger-test/issues).

References
----------

[](#references)

This project uses the [byjg/webrequest](https://github.com/byjg/webrequest) component. It implements the PSR-7 specification, and a HttpClient / MockClient to do the requests. Check it out to get more information.

Dependencies
------------

[](#dependencies)

 ```
flowchart TD
    byjg/swagger-test --> byjg/webrequest
```

      Loading ---

[Open source ByJG](http://opensource.byjg.com)

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 74.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~187 days

Recently: every ~233 days

Total

6

Last Release

626d ago

Major Versions

1.0.3 → 2.0.02024-08-26

PHP version history (4 changes)1.0.0PHP &gt;=5.6

1.0.3PHP &gt;=7.2

2.0.0PHP &gt;=7.4

2.0.1PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/dd0afea8768852e6ced7854312f0d605a0fab1712ec47b5e1d529c2b6f0f9a4f?d=identicon)[m.decarli](/maintainers/m.decarli)

---

Top Contributors

[![byjg](https://avatars.githubusercontent.com/u/981924?v=4)](https://github.com/byjg "byjg (152 commits)")[![UlrichEckhardt](https://avatars.githubusercontent.com/u/8566055?v=4)](https://github.com/UlrichEckhardt "UlrichEckhardt (14 commits)")[![zakima](https://avatars.githubusercontent.com/u/37573?v=4)](https://github.com/zakima "zakima (9 commits)")[![mdecarli](https://avatars.githubusercontent.com/u/170648210?v=4)](https://github.com/mdecarli "mdecarli (7 commits)")[![malinink](https://avatars.githubusercontent.com/u/5726553?v=4)](https://github.com/malinink "malinink (4 commits)")[![antonio-rylke-vgl](https://avatars.githubusercontent.com/u/28530190?v=4)](https://github.com/antonio-rylke-vgl "antonio-rylke-vgl (3 commits)")[![ODAEL](https://avatars.githubusercontent.com/u/4458995?v=4)](https://github.com/ODAEL "ODAEL (3 commits)")[![Hordev](https://avatars.githubusercontent.com/u/66357476?v=4)](https://github.com/Hordev "Hordev (3 commits)")[![domingojimenez](https://avatars.githubusercontent.com/u/113131435?v=4)](https://github.com/domingojimenez "domingojimenez (2 commits)")[![vitormattos](https://avatars.githubusercontent.com/u/1079143?v=4)](https://github.com/vitormattos "vitormattos (2 commits)")[![artjomsimon](https://avatars.githubusercontent.com/u/2609170?v=4)](https://github.com/artjomsimon "artjomsimon (1 commits)")[![steveplevno](https://avatars.githubusercontent.com/u/57771690?v=4)](https://github.com/steveplevno "steveplevno (1 commits)")[![thePanz](https://avatars.githubusercontent.com/u/226021?v=4)](https://github.com/thePanz "thePanz (1 commits)")[![gustavoporcides](https://avatars.githubusercontent.com/u/48253490?v=4)](https://github.com/gustavoporcides "gustavoporcides (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mdc-swagger-test/health.svg)

```
[![Health](https://phpackages.com/badges/mdc-swagger-test/health.svg)](https://phpackages.com/packages/mdc-swagger-test)
```

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[vimeo/psalm

A static analysis tool for finding errors in PHP applications

5.8k77.5M6.7k](/packages/vimeo-psalm)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M570](/packages/beberlei-assert)[mikey179/vfsstream

Virtual file system to mock the real file system in unit tests.

1.4k108.0M2.7k](/packages/mikey179-vfsstream)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
