1. Go to this page and download the library: Download verdet/guzzle-mock 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/ */
verdet / guzzle-mock example snippets
// Create a mock and queue three pairs of request and responses.
$mock = new MockHandler([
[
new Request('GET', 'https://example.com'),
new Response(200, ['X-Foo' => 'Bar'], 'Hello, World')
],
[
new Request('GET', 'https://example.com/latest'),
new Response(202, ['Content-Length' => '0'])],
[
new Request('POST', 'https://example.com/foo'),
new RequestException('Error Communicating with Server', new Request('POST', 'https://example.com/foo'))
]
]);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.