- Is php-vcr/vcr-bundle compatible with Laravel?
- No. VCRBundle is a Symfony bundle that wires php-vcr into Symfony's service container and web profiler; it is not a Laravel package and has no service provider or Laravel integration. Laravel teams should use the underlying php-vcr/php-vcr library directly or rely on Laravel's native Http::fake() for first-party HTTP client tests.
- How do I install php-vcr/vcr-bundle in a Symfony project?
- Install it as a dev dependency with composer require --dev php-vcr/vcr-bundle, then enable the bundle in config/bundles.php for the dev and test environments only. Configure a cassette directory and record mode, and confirm the Composer constraints match your Symfony and PHP versions. Keep it out of production autoloading.
- Can I use PHP-VCR in Laravel without the Symfony bundle?
- Yes. Require php-vcr/php-vcr as a dev dependency and bootstrap VCR in your test base class or a small helper trait. Point it at a cassettes directory, choose a record mode, and wrap the HTTP calls you want recorded. This gives you the core record and replay behavior without any Symfony-specific code.
- What is the difference between PHP-VCR and Laravel Http::fake()?
- Http::fake() intercepts Laravel's HTTP client and returns predefined responses, which is ideal for first-party client tests. PHP-VCR records real HTTP interactions at the Guzzle, cURL, or SOAP layer and replays them later, so it can cover legacy clients and libraries that bypass Laravel's HTTP client. Use Http::fake() first and add PHP-VCR only where you need broader protocol coverage.
- Which Symfony, PHP, and PHPUnit versions does vcr-bundle support?
- The exact ranges are defined in the package's composer.json, so check that file and Packagist before adopting it. The bundle is intended for Symfony 6 and 7 era applications with modern PHP, but you should verify the php-vcr major version it pins and whether it works with your PHPUnit or Pest setup. Also confirm a Flex recipe exists or plan for manual bundle registration.
- How do I redact authorization headers and secrets from VCR cassettes?
- PHP-VCR records raw requests and responses by default, so cassettes can contain auth headers, tokens, and customer payloads. Add custom request and response filters to scrub sensitive headers and body fields before cassettes are written, or post-process them in CI. Store cassettes outside public paths and restrict access to the Symfony profiler panel in dev.
- Does vcr-bundle work with parallel test execution?
- Cassette files are shared state, so parallel tests can conflict if they use the same cassette name or record mode. Use unique cassette names per test, avoid recording in parallel runs, or give each worker its own cassette directory. Verify the bundle's behavior under your parallel runner before scaling it across the suite.
- What does the VCRBundle web profiler panel show?
- The profiler panel exposes recorded HTTP interactions in the Symfony dev environment, which is useful for debugging but can also display tokens, headers, and customer data. Treat it as sensitive and ensure the profiler is disabled or access-controlled outside local development. Review what is captured before sharing dev environments with a wider team.
- Should php-vcr/vcr-bundle be installed in production?
- No. It is test infrastructure and should be a dev-only dependency that never loads in production. Keep it out of production container compilation and confirm that enabling it in test does not leak into prod configuration. The runtime blast radius is low only if it is properly excluded.
- What should I do if vcr-bundle is abandoned or blocks a Symfony upgrade?
- The bundle is a thin convenience layer, so the fallback is a small internal bootstrap wrapper around php-vcr core or a move to native framework fakes where possible. Keep cassette layout and record and replay semantics independent of the bundle so you can swap it out. Verify release cadence and provenance before making it a strategic dependency.