Registry / http-client / php-http-mock-client

php-http-mock-client

JSON →
library1.6.1phppackagistunverified

Mock HTTP client

composer require php-http/mock-client
INSTALL
IMPORT
SIG · PHP-HTTP-MOCK-CLIE
P
php-http-mock-client
http-clientphpv1.6.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Client
use Http\Mock\Client;

Create a mock HTTP client and add a response

use Http\Mock\Client; use Psr\Http\Message\ResponseInterface; $mockClient = new Client(); $mockClient->addResponse($response); // $response implementing ResponseInterface $result = $mockClient->sendRequest($request);
Debug
Known issues
gotchaResponses must implement PSR-7 ResponseInterface; plain arrays are not accepted.
fix
Use a PSR-7 factory like Nyholm\Psr7\Factory\Psr17Factory to create responses.
affects: >=1.0.0
Upgrade
Version history
1.6.1latest on Packagist
Audit
Dependencies

No dependency data recorded yet.

Agent activity
17 hits · last 30 days
node
14
OpenAI (training)
1
Resources
php-http-mock-client — pip install php-http-mock-client · libregistry