jeroen/post-request-sender
Composer 安装命令:
composer require jeroen/post-request-sender
包简介
Micro library with interface for sending post requests. Includes test doubles and adapters
README 文档
README
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; }
Usage
$response = $requestSender->post( 'https://example.com', [ 'foo' => 'bar', 'baz' => 42 ] ); echo $response->body; echo $response->statusCode;
Included implementations
Adapters
GuzzlePostRequestSenderAdapter for Guzzle
Decorators
LoggingPostRequestSenderTakes aPsr\Log\LoggerInterfaceSpyPostRequestSenderTest double that records calls
Test doubles
SpyPostRequestSenderTest double that records callsStubPostRequestSenderTest double that returns a response provided in the constructor
Release notes
2.0.0 (2022-02-03)
- Ditched
ResponseInterfacein favor of a new simple value objectPostResponse
1.0.1 (2022-02-02)
- Fixed behavior of
TestResponse::getBody
1.0.0 (2022-01-30)
Initial release with
PostRequestSenderinterfaceSpyPostRequestSendertest double (andPostRequestvalue object)StubPostRequestSendertest doubleGuzzlePostRequestSenderimplementationLoggingPostRequestSenderdecoratorTestResponsehelper implementation or PSR7ResponseInterface
统计信息
- 总下载量: 33.08k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2022-01-30