jfalque / http-mock-guzzle
Integrates jfalque/http-mock into Guzzle
Installs: 7 090
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=7
- guzzlehttp/guzzle: ~6.0
- jfalque/http-mock: ~1.0
Requires (Dev)
- friendsofphp/php-cs-fixer: 2.0.*
- mikey179/vfsstream: 1.6.*
- phpunit/phpunit: 5.7.*
- symfony/phpunit-bridge: 3.2.*
This package is not auto-updated.
Last update: 2020-11-28 09:50:56 UTC
README
This package is archived and not maintained anymore.
Provides a Guzzle handler that integrates HttpMock.
Installation
Run the following Composer command:
$ composer require --dev jfalque/http-mock-guzzle
Usage
The easiest way to use the HttpMock handler is to create a default stack with the dedicated HttpMockHandler::createStack()
method:
use GuzzleHttp\Client; use Jfalque\HttpMock\Guzzle\HttpMockHandler; use Jfalque\HttpMock\Server; $server = new Server(); $client = new Client([ 'handler' => HttpMockHandler::createStack($server), ]);
The handler can be created manually and used with an existing stack:
$server = new Server(); $handler = new HttpMockHandler($server); $stack->setHandler($handler);
Or injected in a client without using a stack:
$server = new Server(); $client = new Client([ 'handler' => new HttpMockHandler($server), ]);