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 yesterday

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 27% 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

[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)
