PHP code example of jfalque / http-mock-guzzle

1. Go to this page and download the library: Download jfalque/http-mock-guzzle 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/ */

    

jfalque / http-mock-guzzle example snippets


use GuzzleHttp\Client;
use Jfalque\HttpMock\Guzzle\HttpMockHandler;
use Jfalque\HttpMock\Server;

$server = new Server();

$client = new Client([
    'handler' => HttpMockHandler::createStack($server),
]);

$server = new Server();
$handler = new HttpMockHandler($server);
$stack->setHandler($handler);

$server = new Server();
$client = new Client([
    'handler' => new HttpMockHandler($server),
]);