Skip to content

Provides a Guzzle handler that integrates HttpMock.

License

Notifications You must be signed in to change notification settings

freshcells/http-mock-guzzle

 
 

Repository files navigation

HttpMock Guzzle Integration

Build status Latest Stable Version License

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),
]);

About

Provides a Guzzle handler that integrates HttpMock.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 92.7%
  • Dockerfile 4.1%
  • Makefile 3.2%