php-vcr/vcr-bundle
Symfony integration for PHP-VCR that records real HTTP interactions and replays them in your test suite. Configure cassettes, hooks and fixtures to keep functional tests fast, deterministic and offline without changing your HTTP client code.
php-vcr (the recorder/replayer); this bundle is thin glue for Symfony's DI container and web profiler. The decision isn't "build VCR from scratch" — it's "adopt an established library plus a maintenance-light integration" versus writing Guzzle/Symfony HttpClient middleware yourself (a few days of engineering, then owned forever). Weigh ongoing maintenance against a ~13-star, 0-dependent dependency. The 3.0.0 release is a good signal that the glue is at least actively maintained against current Symfony LTS (6.4) and current PHP (8.1–8.5), which de-risks the "will it rot" question somewhat.^8.1, Symfony ^5.4|^6.4, PHPUnit ^9.6|^10.5, php-vcr ^1.6. Teams on PHP 7 or Symfony 4 must stay on the 2.x line, which is now effectively frozen. Treat the platform floor this establishes as a scheduling input when you plan your next PHP/Symfony/PHPUnit upgrades.Adopt when:
VCRTestCaseTrait, which matters if you're modernising your test tooling in parallel.Look elsewhere when:
Http::fake(), Http::preventStrayRequests(), and Http::record()/Http::replay() cover most of this ground natively and are already in the framework you support. This is the decisive criterion for a Laravel shop: the bundle is not installable-useful, even though the underlying php-vcr library can still be used directly as a bare Composer dependency. The 3.0.0 release does not change this calculus at all.2.x, which this release leaves behind; the support-matrix divergence will become an increasing drag over time.MockHttpClient (Symfony) or Guzzle's MockHandler is lower-ceremony than cassette management.require-dev.To executives — one paragraph: We can cut CI flakiness and third-party API spend in our test pipeline by recording real HTTP interactions once and replaying them deterministically on every build. The integration itself is small and low-cost — it wires an established open-source recorder into our framework's dependency injection and debugging tools — so the investment is measured in days, not a quarter, and the payoff is a faster, cheaper, more trustworthy build that doesn't break when a vendor has an outage or throttles us. The 3.0.0 release has modernised the support matrix (PHP 8.1–8.5, Symfony 5.4/6.4, PHPUnit 10), which reduces the "abandonware in our test stack" risk, though Symfony 7 is still not officially supported. The main caveat is that the integration layer remains a small, thinly-adopted open-source project, so we should treat it as require-dev only, keep an exit path, and confirm it applies to our stack before committing engineering time.
To engineering — the substance:
php-vcr with Symfony wiring: a bundle class, DI extension, configuration tree for cassette paths and matching rules, and a web profiler panel showing recorded requests in context. Small surface area; read it in an afternoon.composer require php-vcr/vcr-bundle:^3.0 with no code edits. The catch is the platform floor: PHP 8.1+, Symfony 5.4/6.4, php-vcr 1.6+, PHPUnit 9.6/10.5. If we're stuck on PHP 7 or Symfony 4, we're on 2.x.Http::fake() with Http::preventStrayRequests() in the base TestCase, plus Http::record()/Http::replay() if we want cassette semantics — no third-party bundle required. Nothing in 3.0.0 changes this.require-dev only.How can I help you explore Laravel packages today?