{"id":18339177,"url":"https://github.com/php-vcr/vcrbundle","last_synced_at":"2025-10-11T23:07:12.506Z","repository":{"id":23790388,"uuid":"27166022","full_name":"php-vcr/VCRBundle","owner":"php-vcr","description":"Integrates php-vcr into Symfony and its web profiler.","archived":false,"fork":false,"pushed_at":"2022-12-15T11:47:04.000Z","size":269,"stargazers_count":12,"open_issues_count":4,"forks_count":11,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-21T18:07:02.326Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/php-vcr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-26T08:07:14.000Z","updated_at":"2024-08-21T18:58:49.000Z","dependencies_parsed_at":"2023-01-13T23:52:47.641Z","dependency_job_id":null,"html_url":"https://github.com/php-vcr/VCRBundle","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-vcr%2FVCRBundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-vcr%2FVCRBundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-vcr%2FVCRBundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-vcr%2FVCRBundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/php-vcr","download_url":"https://codeload.github.com/php-vcr/VCRBundle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247440391,"owners_count":20939220,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T20:16:48.319Z","updated_at":"2025-10-11T23:07:07.447Z","avatar_url":"https://github.com/php-vcr.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"VCRBundle\n=========\n\nIntegrates [php-vcr](https://github.com/php-vcr/php-vcr) into Symfony and its\nweb profiler.\nIt also provides a VideoRecorderBrowser for testing purpose with extra helper methods handling php-vcr recordings.\n\n\u003cimg src=\"https://cloud.githubusercontent.com/assets/66958/5232274/b841676e-774b-11e4-8f4e-1f3e8cb7739e.png\" width=\"280\" height=\"175\" alt=\"PHP-VCR Symfony web profiler panel\"/\u003e\n\u003cimg src=\"https://cloud.githubusercontent.com/assets/66958/5232275/b84288d8-774b-11e4-803c-7b72f75e59b0.png\" width=\"280\" height=\"175\" alt=\"PHP-VCR Symfony web profiler panel - request details\"/\u003e\n\u003cimg src=\"https://cloud.githubusercontent.com/assets/66958/5232276/b84411b2-774b-11e4-93a9-475a0eeede65.png\" width=\"280\" height=\"175\" alt=\"PHP-VCR Symfony web profiler panel - response details\"/\u003e\n\n## Installation\n\nInstall the behavior adding `php-vcr/vcr-bundle` to your composer.json or\nfrom CLI:\n\n```bash\ncomposer require php-vcr/vcr-bundle\n```\n\nAnd declare the bundle in your `config/bundles.php` file:\n\n```php\n\u003c?php\ndeclare(strict_types = 1);\n\nreturn [\n    // ...\n    VCR\\VCRBundle\\VCRBundle::class =\u003e ['test' =\u003e true],\n];\n```\n\n## Usage\n\nEnable the required library hooks for your purpose and write test cases.\n\n### VideoRecorderBrowser (without Trait)\n\n```php\n\u003c?php\ndeclare(strict_types = 1);\n\nclass ExampleTest extends \\VCR\\VCRBundle\\Tests\\Functional\\WebTestCase\n{\n    public function test(): void\n    {\n        $kernel = static::bootKernel();\n        /** @var \\VCR\\VCRBundle\\VideoRecorderBrowser $client */\n        $client = $kernel-\u003egetContainer()-\u003eget('test.client.vcr');\n        \n        $client-\u003einsertVideoRecorderCassette('my-test-cassette-name');\n        \n        // this is an example, normally services inside you project do stuff like this and you trigger them by\n        // execute requests via the KernelBrowser client\n        file_get_contents('https://www.google.de');\n        \n        // cassette.path is configured to '%kernel.project_dir%/tests/Fixtures'\n        // recordings are written to %kernel.project_dir%/tests/Fixtures/my-test-cassette-name\n        // cassette.path + cassetteName (done by inserting the cassette)\n    }\n}\n```\n\n### VideoRecorderBrowser (with Trait)\n\n```php\n\u003c?php\ndeclare(strict_types = 1);\n\nnamespace MyCompany\\MyProject\\Tests\\Functional;\n\nclass ExampleTest extends \\VCR\\VCRBundle\\Tests\\Functional\\WebTestCase\n{\n    use \\VCR\\VCRBundle\\Test\\VCRTestCaseTrait;\n\n    /**\n     * Specify a namespace prefix which should be ignored while generating the base path for this test case. \n     */\n    protected $ignoredTestSuiteNamespacePrefix = 'MyCompany\\\\MyProject\\\\Tests\\\\';\n\n    public function test(): void\n    {\n        /** @var \\VCR\\VCRBundle\\VideoRecorderBrowser $client */\n        $client = static::createVideoRecorderClient();\n        \n        // this is an example, normally services inside you project do stuff like this and you trigger them by\n        // execute requests via the KernelBrowser client\n        file_get_contents('https://www.google.de');\n        \n        // cassette.path is configured to '%kernel.project_dir%/tests/Fixtures'\n        // recordings are written to %kernel.project_dir%/tests/Fixtures/Functional/ExampleTest/test\n        // cassette.path + TestCasePath (- ignoredTestSuiteNamespacePrefix) + TestName\n    }\n}\n```\n\n## Configuration reference\n\n```yaml\nvcr:\n  enabled: true\n  library_hooks:\n    stream_wrapper: false\n    curl: false\n    soap: false\n  request_matchers:\n    method: true\n    url: true\n    query_string: true\n    host: true\n    headers: true\n    body: true\n    post_fields: true\n  cassette:\n    type: json\n    path: '%kernel.cache_dir%/vcr'\n    name: vcr\n```\n\n## Credits\n\n* [Kévin Gomez](http://github.com/K-Phoen/)\n* [Ludovic Fleury](https://github.com/ludofleury) - to whom I borrowed the\n  design of the web profiler part from his [GuzzleBundle](https://github.com/ludofleury/GuzzleBundle/).\n* [Simon Hübner](https://github.com/simonhard) - making the bundle SF 5.4 compatible\n* [Daniel Hürtgen](https://github.com/higidi) - making the bundle PHP 8 compatible and providing extra TestCase helper\n\n## License\n\nThis bundle is released under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-vcr%2Fvcrbundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphp-vcr%2Fvcrbundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-vcr%2Fvcrbundle/lists"}