PackageTrack
Sign in Get early access

hotmeteor/spectator

Testing helpers for your OpenAPI spec

v3.0.4 1.8M downloads/mo #1866 most downloaded on Packagist hotmeteor/spectator

What this package is like to depend on

Last release today

23 Aug 2026

Release timing varies

gaps range from 2 weeks to 12 months

Rarely documented

notes for 8 of 68 stable releases

Nothing withdrawn

no release was ever pulled

6 years old

68 releases · first in 2020

8 releases in the last 12 months

see the full history below

Release timeline

68 releases · May 2020 to Aug 2026
2021 2022 2023 2024 2025 2026
Release Pre-release

Releases

latest 60 of 68
  1. v3.0.4 23 Aug 2026

    Nothing published for this version

  2. v3.0.3 23 Aug 2026

    Nothing published for this version

  3. v3.0.2 01 May 2026
    Release notes

    What's Changed

    • Add --prefix and --middleware filters to spectator:routes by @jaap in #221

    New Contributors

    • @jaap made their first contribution in #221

    Full Changelog: v3.0.1...v3.0.2

    Open source →
  4. v3.0.1 28 Apr 2026
    Release notes

    Full Changelog: v3.0.0...v3.0.1

    Open source →
  5. v3.0.0 28 Apr 2026
    Release notes

    v3 is a significant release that raises the platform floor, adds a suite of developer-experience tools, and fixes several validation edge cases.


    Breaking Changes

    Minimum requirements

    • PHP 8.3+ required (was 8.1+)
    • Laravel 12+ required (was 10+)

    New config key
    A new error_format key is required in config/spectator.php. If you published the config in v2, add:

    'error_format' => env('SPECTATOR_ERROR_FORMAT', 'text'),

    No behaviour change unless you set SPECTATOR_ERROR_FORMAT=json.

    Internal type changes (extenders only)
    If you extend Spectator's validator classes, note that:

    • 'read' / 'write' strings in AbstractValidator are now ValidationMode::Read / ValidationMode::Write enum cases
    • Format::TEXT_GREEN style class constants are now Format::TextGreen string-backed enum cases

    These are internal details — if you only use the public facade and TestResponse assertions, no action is required.

    See UPGRADE.md for the full list.


    New Features

    Artisan Commands

    Four new artisan commands provide visibility into your spec and its relationship to your application.

    spectator:validate — lint a spec file before tests run:

    php artisan spectator:validate --spec=Api.v1.yml
    php artisan spectator:validate --spec=Api.v1.yml --format=json

    spectator:coverage — list every operation defined in the spec:

    php artisan spectator:coverage --spec=Api.v1.yml

    spectator:routes — cross-reference spec operations against your registered Laravel routes:

    php artisan spectator:routes --spec=Api.v1.yml

    Outputs matched, unimplemented, and undocumented routes at a glance.

    spectator:stubs — generate skeleton test classes from a spec, ready to fill in:

    php artisan spectator:stubs --spec=Api.v1.yml --output=tests/Contract

    Operations are grouped by tag (falling back to path segment), producing one test class per group with one markTestIncomplete method per operation.

    All commands support --format=json for machine-readable output.

    PHPUnit Coverage Extension

    SpectatorExtension is a PHPUnit 11 extension that tracks which spec operations are exercised across the full test run and prints a summary table when the suite finishes. Configure a minimum threshold to fail CI when coverage drops:

    <extensions>
        <bootstrap class="Spectator\Coverage\SpectatorExtension">
            <parameter name="min_coverage" value="80"/>
        </bootstrap>
    </extensions>

    JSON Error Format

    Validation errors can now be emitted as structured JSON instead of ANSI-coloured text — useful for CI log parsers, LLM-driven workflows, and anything that processes test output programmatically:

    SPECTATOR_ERROR_FORMAT=json

    Or toggle per test:

    Spectator::useJsonErrors();
    Spectator::useTextErrors();

    A failed assertion with JSON errors produces:

    { "errors": ["The data (null) must match the type: string"] }

    Fluent Path Prefix API

    Spectator::withPathPrefix('v1');

    As an alternative to setting SPECTATOR_PATH_PREFIX in .env.

    AI & CI Integration

    The combination of spectator:validate --format=json, SPECTATOR_ERROR_FORMAT=json, and SpectatorExtension makes Spectator a natural fit for AI-driven development workflows — structured outputs at every stage mean errors and coverage gaps can be piped directly into LLM toolchains.


    Bug Fixes

    • Nullable inside additionalProperties not migrated — OpenAPI 3.0 nullable: true on dictionary value schemas was silently skipped during the 3.0 to 3.1 nullable migration. Values like null were incorrectly rejected. (#215)

    • Comma-separated values in header parametersexplode: false with type: array on in: header parameters now correctly splits the comma-separated string into an array before validation, matching the existing behaviour for query parameters. (inspired by #213)

    • TypeError with empty request body on allOf schemas — sending an empty body against a required allOf request body no longer throws a TypeError. The error is now a clean "Request body required!" validation failure. (#216)

    • Nullable properties inside allOfnullable: true on properties nested within allOf arms is correctly migrated to 3.1-style type: [T, null]. (#212)


    Internals

    • PHP enums replace string and class constants throughout (ValidationMode, Format, Source)
    • First-class callables, readonly properties, and match expressions used where appropriate
    • PHPStan level 6 enforced in CI with zero errors
    • Test suite expanded from ~180 to 248 test cases
    • GitHub Actions matrix covers PHP 8.3/8.4 x Laravel 12/13
    • All dependency version constraints loosened on the upper bound so future Laravel versions work without a constraint update

    Full Changelog

    v2.5.2...v3.0.0

    Open source →
  6. v2.3.0 28 Apr 2026
    Release notes

    Full Changelog: v2.2.1...v2.3.0

    Open source →
  7. v2.2.1 28 Apr 2026
    Release notes

    What's Changed

    New Contributors

    Full Changelog: v2.2.0...v2.2.1

    Open source →
  8. v2.2.0 27 Mar 2026
    Release notes

    What's Changed

    Full Changelog: v2.1.2...v2.2.0

    Open source →
  9. v2.1.2 04 Jun 2025
    Release notes

    What's Changed

    Full Changelog: v2.1.1...v2.1.2

    Open source →
  10. 2.1.1 02 Jun 2025
    Release notes

    What's Changed

    New Contributors

    Full Changelog: v2.1.0...v2.1.1

    Open source →
  11. 2.1.0 13 Mar 2025

    Nothing published for this version

  12. v1.11.0 16 Jan 2024

    Nothing published for this version

  13. v1.10.0 11 Aug 2023

    Nothing published for this version

  14. v1.9.1 28 Jul 2023

    Nothing published for this version

  15. v1.9.0 28 Jul 2023

    Nothing published for this version

  16. v1.8.0 21 Feb 2023

    Nothing published for this version

  17. v1.7.1 24 Oct 2022

    Nothing published for this version

  18. v1.7.0 07 Sep 2022

    Nothing published for this version

  19. v1.6.0 08 Aug 2022

    Nothing published for this version

  20. v1.5.1 08 Aug 2022

    Nothing published for this version

  21. v1.5.0 21 Feb 2022

    Nothing published for this version

  22. v1.4.1 25 Jan 2022

    Nothing published for this version

  23. v1.4.0 10 Dec 2021

    Nothing published for this version

  24. v1.3.0 06 Oct 2021

    Nothing published for this version

  25. v1.2.3 14 Sep 2021

    Nothing published for this version

  26. v1.2.2 24 May 2021

    Nothing published for this version

  27. v1.2.1 21 May 2021

    Nothing published for this version

  28. v1.2.0 18 May 2021

    Nothing published for this version

  29. v1.1.1 15 May 2021

    Nothing published for this version

  30. v1.1.0 13 May 2021

    Nothing published for this version

  31. v1.0.5 13 May 2021

    Nothing published for this version

  32. v1.0.4 13 May 2021

    Nothing published for this version

  33. v1.0.3 11 May 2021

    Nothing published for this version

  34. v1.0.2 03 May 2021

    Nothing published for this version

  35. v1.0.1 21 Apr 2021

    Nothing published for this version

  36. v1.0.0 21 Apr 2021

    Nothing published for this version

  37. v0.8.5 17 Feb 2021

    Nothing published for this version

  38. v0.8.4 16 Feb 2021

    Nothing published for this version

  39. v0.8.3 16 Feb 2021

    Nothing published for this version

  40. v0.8.2 05 Feb 2021

    Nothing published for this version

  41. v0.8.1 02 Feb 2021

    Nothing published for this version

  42. v0.8.0 27 Jan 2021

    Nothing published for this version

  43. v0.7.1 27 Jan 2021

    Nothing published for this version

  44. v0.7.0 18 Dec 2020

    Nothing published for this version

  45. v0.6.5 10 Dec 2020

    Nothing published for this version

  46. v0.6.4 01 Dec 2020

    Nothing published for this version

  47. v0.6.3 29 Nov 2020

    Nothing published for this version

  48. v0.6.2 21 Nov 2020

    Nothing published for this version

  49. v0.6.1 20 Nov 2020

    Nothing published for this version

  50. v0.6.0 20 Nov 2020

    Nothing published for this version

  51. v0.5.5 19 Nov 2020

    Nothing published for this version

  52. v0.5.4 09 Nov 2020

    Nothing published for this version

  53. v0.5.3 02 Nov 2020

    Nothing published for this version

  54. v0.5.2 02 Nov 2020

    Nothing published for this version

  55. v0.5.1 02 Nov 2020

    Nothing published for this version

  56. v0.5.0 31 Oct 2020

    Nothing published for this version

  57. v0.4.0 17 Oct 2020

    Nothing published for this version

  58. v0.3.1 26 Jun 2020

    Nothing published for this version

  59. v0.3.0 09 Jun 2020

    Nothing published for this version

  60. v0.2.1 08 Jun 2020

    Nothing published for this version

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive