PHP code example of svilborg / guzzle-file-snapshot

1. Go to this page and download the library: Download svilborg/guzzle-file-snapshot 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/ */

    

svilborg / guzzle-file-snapshot example snippets


$client = new GuzzleFileMock([
	            'file_mock' => __DIR__ . '/snapshots/',
	            'base_uri' => 'https://some.endpoint.org/'
	            ]);

$client->post("users", [
	            "form_params" => ["name" => "Peter"]
	        ]);

$client = new GuzzleFileMock([
	            'file_mock' => __DIR__ . '/snapshots/',
	            'file_mock_ext' => 'txt',
	            'file_mock_serializer' => '\GuzzleHttpMock\Serializer\PhpSerializer',
	            'base_uri' => 'https://some.endpoint.org/'
	            ]);

$client->post("users", [
	            "form_params" => ["name" => "Peter"]
	        ]);