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

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

pion/laravel-swagger-test
=========================

Test your routes using Laravel's underlying request testing (without making real request) against your API schema.

43.9k5PHP

Since Feb 4Pushed 5y ago1 watchersCompare

[ Source](https://github.com/pionl/laravel-swagger-test)[ Packagist](https://packagist.org/packages/pion/laravel-swagger-test)[ RSS](/packages/pion-laravel-swagger-test/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Swagger Test
====================

[](#laravel-swagger-test)

> Underlying logic uses [PHP Swagger Test](https://github.com/byjg/php-swagger-test) from [byjg](https://github.com/byjg)

Test your routes using Laravel's underlying request testing (without making real request) against your API schema.

Support
-------

[](#support)

> How to make tests and which OpenAPI is supported check the [PHP Swagger Test](https://github.com/byjg/php-swagger-test).

At the time of writing this readme OpenAPI 3 is partially supported.

Install
-------

[](#install)

1. Add a custom repository for php-swagger-test with internal improvements. (In future it could be merged).

    ```
    "repositories": [
        {
            "type": "git",
            "url": "https://github.com/pionl/php-swagger-test"
        }
    ]

    ```
2. Require the package

    ```
    compsoer require pion/laravel-swagger-test

    ```

Usage
-----

[](#usage)

Use the Laravel's TestCase and use `AssertRequestAgainstSchema` trait assert request against schema.

Uses same "request building" as `ApiRequester`. For more details check the [PHP Swagger Test](https://github.com/byjg/php-swagger-test).

```
use Tests\TestCase;
use ByJG\ApiTools\AssertRequestAgainstSchema;
use ByJG\ApiTools\Base\Schema;
use ByJG\ApiTools\Laravel\LaravelRequester;

class GetUsersTest extends TestCase
{
   use AssertRequestAgainstSchema;

   /**
    * Loaded schema for phpunit instance.
    *
    * @var Schema|null
    */
   public static $cachedSchema = null;

   protected function setUp()
   {
       parent::setUp();

       // Load only once, must be made in setup to be able to use base_path
       if (null !== $this->schema) {
           return;
       }

       // Load only once per phpunit instance
       if (null === self::$cachedSchema) {
           self::$cachedSchema = Schema::getInstance(file_get_contents(base_path('docs/api.json')));
       }

       // Set the schema
       $this->setSchema(self::$cachedSchema);
   }

   public function testGetUsersWithoutFiltersInElasticSearchAgainstSchema()
   {
       // Create data
       $this->createUser();

       $request = new LaravelRequester($this);
       $request
           ->withMethod('GET')
           ->withPath('/v1/users');

       $this->assertRequest($request);
   }
}
```

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity31

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/ad0f2a11e630f5f386cb8544d42f0c56c2b89258172dae581a33dddcc5de1d83?d=identicon)[pionl](/maintainers/pionl)

---

Top Contributors

[![pionl](https://avatars.githubusercontent.com/u/1878831?v=4)](https://github.com/pionl "pionl (8 commits)")

---

Tags

apilaravelopenapiphpunitswaggertesting-tools

### Embed Badge

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

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

###  Alternatives

[dms/phpunit-arraysubset-asserts

This package provides ArraySubset and related asserts once deprecated in PHPUnit 8

14429.2M360](/packages/dms-phpunit-arraysubset-asserts)

PHPackages © 2026

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