PHPackages                             ysato/spectator - 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. ysato/spectator

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

ysato/spectator
===============

An Artisan command package for Laravel to improve code quality and project structure.

1.1.3(9mo ago)01.0k↓50%1MITPHPPHP ^8.2CI passing

Since Aug 6Pushed 4mo agoCompare

[ Source](https://github.com/ysato/Ysato.Spectator)[ Packagist](https://packagist.org/packages/ysato/spectator)[ Docs](https://github.com/ysato/Ysato.Spectator)[ RSS](/packages/ysato-spectator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (10)Versions (9)Used By (1)

Ysato.Spectator
===============

[](#ysatospectator)

OpenAPI specification coverage visualization library for Laravel Feature tests

[![PHP Version](https://camo.githubusercontent.com/962aced9b09d89716dbebf186ff899754a096ff1068b6b7988675c2d9fab9331/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e322d626c75652e737667)](https://php.net/)[![Laravel](https://camo.githubusercontent.com/369c88f5bce3ed453a64315a364fe266b721fcaa0b6753024eb521ffd6462af5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d25354531312e343325374325354531322e302d7265642e737667)](https://laravel.com/)[![License](https://camo.githubusercontent.com/8bb50fd2278f18fc326bf71f6e88ca8f884f72f179d3e555e20ed30157190d0d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e2e737667)](LICENSE)

Overview
--------

[](#overview)

Ysato.Spectator is a library for visualizing OpenAPI specification coverage in Laravel Feature tests. By integrating it into your existing Feature tests, you can clearly see which endpoints defined in your OpenAPI specification are tested and which ones are missing from your test suite.

### Key Features

[](#key-features)

- **Test Coverage Visualization**: Display test coverage for OpenAPI specifications in a table format
- **Automatic Tracking**: Automatically monitor Feature test execution and record endpoint usage
- **Laravel Integration**: Easy integration with Laravel Feature tests

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

[](#installation)

Install via Composer:

```
composer require --dev ysato/spectator
```

Usage
-----

[](#usage)

### 1. Prepare OpenAPI Specification File

[](#1-prepare-openapi-specification-file)

Place an OpenAPI specification file (YAML format) in your project:

```
# openapi.yaml
openapi: 3.0.0
info:
  title: My API
  version: 1.0.0
paths:
  /api/users:
    get:
      responses:
        '200':
          description: Success
        '404':
          description: Not Found
    post:
      responses:
        '201':
          description: Created
        '422':
          description: Validation Error
  /api/users/{id}:
    get:
      responses:
        '200':
          description: Success
        '404':
          description: Not Found
```

### 2. Use Spectator in Feature Tests

[](#2-use-spectator-in-feature-tests)

Use the `Spectatable` trait in `tests/Feature/TestCase.php`:

```
