Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Phpunit Testlistener Vcr Laravel Package

php-vcr/phpunit-testlistener-vcr

PHPUnit TestListener integrating PHP-VCR via @vcr annotations. Automatically turns VCR on/off per test and records/replays HTTP interactions using named cassettes. Install with Composer and register the listener in phpunit.xml.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Accelerated Test Development: Enables rapid API/integration test creation by recording and replaying HTTP interactions, reducing reliance on external services during development.
  • CI/CD Optimization: Cuts CI pipeline costs and execution time by avoiding unnecessary network calls to third-party APIs (e.g., payment gateways, SaaS services) during test runs.
  • Deterministic Testing: Mitigates flakiness caused by rate limits, throttling, or intermittent service outages, improving test reliability.
  • Compliance/Regulatory Testing: Safely mocks sensitive endpoints (e.g., payment processors, auth services) without exposing real credentials in test environments.
  • Feature Roadmap: Justifies investment in test automation for:
    • New integrations with third-party APIs.
    • Legacy systems with unreliable test environments.
    • Teams adopting PHPUnit for the first time.
  • Build vs. Buy: Avoids reinventing VCR (Video Cassette Recorder) functionality; leverages battle-tested open-source tooling instead of custom solutions.
  • PHP 8 Compatibility: Expands adoption potential by supporting modern PHP versions, reducing friction for teams upgrading their stack.

When to Consider This Package

Adopt if:

  • Your team relies on external APIs (e.g., Stripe, Twilio, AWS) for integration tests.
  • Flaky tests due to network dependencies slow down development or CI.
  • You need to reduce CI costs by minimizing API calls in test suites.
  • Your team uses PHPUnit and wants to adopt VCR-style recording/replay.
  • You’re building sensitive or regulated systems where mocking real endpoints is critical.
  • You are using PHP 8.x and need a maintained, up-to-date testing solution.

Look elsewhere if:

  • Your tests are unit-focused with no HTTP dependencies (use PHPUnit mocks instead).
  • You’re using a non-PHP stack (e.g., JavaScript, Python) or a different testing framework.
  • Your API dependencies are highly dynamic (e.g., real-time WebSockets) and VCR’s replay model isn’t suitable.
  • You lack developer buy-in for maintaining recorded cassettes (requires discipline to update them).
  • You are using PHP versions below 8.0 (this package no longer supports older versions).

How to Pitch It (Stakeholders)

For Executives: "This package lets us record and replay API interactions during testing—like hitting ‘pause’ on external services. It slashes CI costs by 30–50% (fewer real API calls) and makes tests run faster and more reliably. With PHP 8 support, it’s now future-proof for our modern stack. For example, if we’re integrating with Stripe or a payment processor, we can test locally without touching production. It’s a low-risk way to stabilize our test suite and accelerate feature delivery."

For Engineering: *"PHP-VCR + this listener turns PHPUnit into a time machine for HTTP calls. You record a test’s API interactions once, then replay them offline. No more ‘works on my machine’ issues from flaky APIs. New in 3.3.0: PHP 8 support, so it’s now a seamless fit for our upgraded stack. It’s especially useful for:

  • New hires ramping up on integrations.
  • Legacy systems with unreliable test environments.
  • Security-sensitive endpoints where we can’t mock easily. Downside: You’ll need to update cassettes when APIs change—but that’s a one-time cost for long-term stability."*

For Developers: *"Imagine running phpunit without waiting for slow APIs or hitting rate limits. This package lets you:

  • Record a test’s HTTP calls once (e.g., GET /api/payments).
  • Replay them instantly in future runs.
  • Skip real API calls in CI, speeding up pipelines. Setup is easy: Add the listener to PHPUnit, annotate tests with @vcr, and go. Now with PHP 8 support, it’s perfect for API-heavy projects like [Project X] or [Service Y]."
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor