Micro library with interface for sending post requests. Includes test doubles and adapters

2.0.0 2022-02-03 22:27 UTC

This package is auto-updated.

Last update: 2024-05-14 19:12:35 UTC


Build Status codecov Type Coverage Psalm level Latest Stable Version Download count

Micro library with PostRequestSender interface and some test doubles.

For the common cases where you do not need the complexity of the heavyweight libraries.

interface PostRequestSender {

	 * @param string $url
	 * @param array<string, mixed> $fields
	public function post( string $url, array $fields ): PostResponse;



$response = $requestSender->post( '', [ 'foo' => 'bar', 'baz' => 42 ] );
echo $response->body;
echo $response->statusCode;

Included implementations


  • GuzzlePostRequestSender Adapter for Guzzle


  • LoggingPostRequestSender Takes a Psr\Log\LoggerInterface
  • SpyPostRequestSender Test double that records calls

Test doubles

  • SpyPostRequestSender Test double that records calls
  • StubPostRequestSender Test double that returns a response provided in the constructor

Release notes

2.0.0 (2022-02-03)

  • Ditched ResponseInterface in favor of a new simple value object PostResponse

1.0.1 (2022-02-02)

  • Fixed behavior of TestResponse::getBody

1.0.0 (2022-01-30)

Initial release with

  • PostRequestSender interface
  • SpyPostRequestSender test double (and PostRequest value object)
  • StubPostRequestSender test double
  • GuzzlePostRequestSender implementation
  • LoggingPostRequestSender decorator
  • TestResponse helper implementation or PSR7 ResponseInterface