PHP code example of php-http / vcr-plugin
1. Go to this page and download the library: Download php-http/vcr-plugin library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
php-http / vcr-plugin example snippets
use Http\Client\Plugin\Vcr\NamingStrategy\PathNamingStrategy;
use Http\Client\Plugin\Vcr\Recorder\FilesystemRecorder;
use Http\Client\Plugin\Vcr\RecordPlugin;
use Http\Client\Plugin\Vcr\ReplayPlugin;
$namingStrategy = new PathNamingStrategy();
$recorder = new FilesystemRecorder('some/dir/in/vcs'); // You can use InMemoryRecorder as well
// To record responses:
$record = new RecordPlugin($namingStrategy, $recorder);
// To replay responses:
$replay = new ReplayPlugin($namingStrategy, $recorder);