PHPackages                             fr3d/swagger-assertions - 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. fr3d/swagger-assertions

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

fr3d/swagger-assertions
=======================

Test your API requests and responses against your swagger definition

v1.0.0(5y ago)138850.9k—2.4%27[4 issues](https://github.com/Maks3w/SwaggerAssertions/issues)[3 PRs](https://github.com/Maks3w/SwaggerAssertions/pulls)5BSD-2-ClausePHPPHP &gt;= 7.2

Since Apr 8Pushed 4y ago7 watchersCompare

[ Source](https://github.com/Maks3w/SwaggerAssertions)[ Packagist](https://packagist.org/packages/fr3d/swagger-assertions)[ Docs](https://github.com/Maks3w/SwaggerAssertions)[ RSS](/packages/fr3d-swagger-assertions/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (24)Used By (5)

Swagger Assertions
==================

[](#swagger-assertions)

Test any API requests and responses match with the models described in the documentation.

This project is compatible with [Swagger 2](http://swagger.io/) spec definitions.

Installing via Composer
-----------------------

[](#installing-via-composer)

You can use [Composer](https://getcomposer.org) .

```
composer require fr3d/swagger-assertions
```

Usage in PHPUnit
----------------

[](#usage-in-phpunit)

There are two traits for provide predefined helper functions for different assertions.

- [AssertsTrait](src/PhpUnit/AssertsTrait.php) For assert different parts of the response
- [Psr7AssertsTrait](src/PhpUnit/Psr7AssertsTrait.php) For assert [PSR-7 compatible](http://www.php-fig.org/psr/psr-7/) responses.
- [SymfonyAssertsTrait](src/PhpUnit/SymfonyAssertsTrait.php) For assert [Symfony HTTP Foundation](http://symfony.com/doc/current/components/http_foundation/index.html) responses.

See examples at [examples/PhpUnit](examples/PhpUnit)

FAQ
---

[](#faq)

 Q: Can this library validate my Swagger definition? A: No. This library validate your API requests and responses match your Swagger definition.License
-------

[](#license)

Code licensed under BSD 2 clauses terms &amp; conditions.

See [LICENSE.txt](LICENSE.txt) for more information.

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity55

Moderate usage in the ecosystem

Community25

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 91% 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 ~105 days

Recently: every ~240 days

Total

21

Last Release

1956d ago

Major Versions

v0.12.0 → v1.0.02021-01-08

PHP version history (6 changes)v0.1.3PHP &gt;= 5.4.0

v0.4.0PHP &gt;= 5.5.0

v0.7.0PHP &gt;= 5.6.0

v0.8.0PHP &gt;= 7.0

v0.9.0PHP &gt;= 7.1

v0.12.0PHP &gt;= 7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/19fdc97ccc21fe2689824d70ab378dfd2364433eeaca3e9b321beeb68eb79106?d=identicon)[Maks3w](/maintainers/Maks3w)

---

Top Contributors

[![Maks3w](https://avatars.githubusercontent.com/u/1301698?v=4)](https://github.com/Maks3w "Maks3w (151 commits)")[![Nicofuma](https://avatars.githubusercontent.com/u/591456?v=4)](https://github.com/Nicofuma "Nicofuma (7 commits)")[![jessedc](https://avatars.githubusercontent.com/u/17407?v=4)](https://github.com/jessedc "jessedc (6 commits)")[![MasonM](https://avatars.githubusercontent.com/u/651224?v=4)](https://github.com/MasonM "MasonM (2 commits)")

---

Tags

assertionshacktoberfestopenapiphpswaggertestingphpunitapitestswaggerassertion

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/fr3d-swagger-assertions/health.svg)

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

###  Alternatives

[infyomlabs/laravel-generator

InfyOm Laravel Generator

3.8k2.3M13](/packages/infyomlabs-laravel-generator)[ta-tikoma/phpunit-architecture-test

Methods for testing application architecture

10745.9M13](/packages/ta-tikoma-phpunit-architecture-test)[php-mock/php-mock-phpunit

Mock built-in PHP functions (e.g. time()) with PHPUnit. This package relies on PHP's namespace fallback policy. No further extension is needed.

1718.2M399](/packages/php-mock-php-mock-phpunit)[elliotchance/concise

Concise is test framework for using plain English and minimal code, built on PHPUnit.

45223.8k4](/packages/elliotchance-concise)[albertcht/lumen-testing

Testing Suite For Lumen like Laravel does.

4335.5k1](/packages/albertcht-lumen-testing)[robiningelbrecht/phpunit-coverage-tools

PHPUnit coverage tools

1783.0k34](/packages/robiningelbrecht-phpunit-coverage-tools)

PHPackages © 2026

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