svilborg/guzzle-file-snapshot

Guzzle File Snapshot Mock

1.0.1 2018-11-01 20:15 UTC

README

Guzzle File Mock

Build Status Latest Stable Version License

Guzzle Mocking of Http calls to file system. On first call creates a snapshot and uses it afterwords.

Usage

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

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

Php serializer and extension :

$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"]
	        ]);