PHPackages                             greensight/laravel-openapi-testing - 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. greensight/laravel-openapi-testing

Abandoned → [ensi/laravel-openapi-testing](/?search=ensi%2Flaravel-openapi-testing)ArchivedLibrary[Testing &amp; Quality](/categories/testing)

greensight/laravel-openapi-testing
==================================

0.1.0(4y ago)4975MITPHPPHP ^8.0

Since Aug 24Pushed 4y agoCompare

[ Source](https://github.com/greensight/laravel-openapi-testing)[ Packagist](https://packagist.org/packages/greensight/laravel-openapi-testing)[ RSS](/packages/greensight-laravel-openapi-testing/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (7)Versions (2)Used By (0)

Laravel OpenApi Testing
=======================

[](#laravel-openapi-testing)

`Deprecated, use https://github.com/ensi-platform/laravel-openapi-testing instead`

This packages is based on `osteel/openapi-httpfoundation-testing` and provides `ValidatesAgainstOpenApiSpec` trait

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

[](#installation)

You can install the package via composer:

`composer require greensight/laravel-openapi-testing`

Basic usage
-----------

[](#basic-usage)

Let's add validation according to oas3 to our tests. All we need is to `use ValidatesAgainstOpenApiSpec;` and implement `getOpenApiDocumentPath(): string` method like that:

```
class SomeTestCase extends AnotherTestCase
{
    use ValidatesAgainstOpenApiSpec;

    protected function getOpenApiDocumentPath(): string
    {
        return public_path('api-docs/v1/index.yaml');
    }
}
```

The trait overrides `$this->call` method to add the needed validation As a result all http related helper methods (`$this->get()`, `$this->postJson()` and e.t.c) perform the validation too. Both request and response is validated to match some part of the given spec. If validation fails your tests is automatically marked as failed, no need to need any manual assertions.

### Turning validation off

[](#turning-validation-off)

In some cases you may want to turn validation for a specific request. Here is an exanple how to do it:

```
// Turn off validation for both request
$this->skipNextOpenApiRequestValidation()->getJson(...);

// Turn off validation for both response
$this->skipNextOpenApiResponseValidation()->getJson(...);

// Turn off validation for both request and response
$this->skipNextOpenApiValidation()->getJson(...);
```

### Mapping paths

[](#mapping-paths)

In order to validate request against oas3 the package need to map it to one of the paths described in specification document. We use path from Laravel's route (`$request->route()->uri`) for that purpose. If it does not fully match in your case you can explicitly set OpenApi path for the current request like that:

```
$this->forceOpenApiPath('/pets/{petId}')->getJson(...);
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

### Testing

[](#testing)

1. composer install
2. npm i
3. composer test

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1727d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/58d505cd6b2551974b0c076d133fd9a3c9cd635bbf308adb17a6399bd3b63232?d=identicon)[Arrilot](/maintainers/Arrilot)

---

Top Contributors

[![arrilot](https://avatars.githubusercontent.com/u/2826480?v=4)](https://github.com/arrilot "arrilot (1 commits)")

---

Tags

laravelfactory

###  Code Quality

TestsPest

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/greensight-laravel-openapi-testing/health.svg)

```
[![Health](https://phpackages.com/badges/greensight-laravel-openapi-testing/health.svg)](https://phpackages.com/packages/greensight-laravel-openapi-testing)
```

###  Alternatives

[mpociot/laravel-test-factory-helper

Generate Laravel test factories from your existing models

933635.2k2](/packages/mpociot-laravel-test-factory-helper)[thedoctor0/laravel-factory-generator

Automatically generate Laravel factories for your models.

214997.4k1](/packages/thedoctor0-laravel-factory-generator)[laravel-shift/factory-generator

Generate factories from existing models

49697.9k](/packages/laravel-shift-factory-generator)[laracasts/behat-laravel-extension

Laravel extension for Behat

2611.3M12](/packages/laracasts-behat-laravel-extension)[kunicmarko/graphql-test

GraphQL Test Cases

1359.0k](/packages/kunicmarko-graphql-test)[mnabialek/laravel-quick-migrations

Run Laravel tests quicker

2210.9k](/packages/mnabialek-laravel-quick-migrations)

PHPackages © 2026

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