定制 jeroen/post-request-sender 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

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;

}

Usage

$response = $requestSender->post( 'https://example.com', [ 'foo' => 'bar', 'baz' => 42 ] );
echo $response->body;
echo $response->statusCode;

Included implementations

Adapters

  • GuzzlePostRequestSender Adapter for Guzzle

Decorators

  • 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

统计信息

  • 总下载量: 33.08k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2022-01-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固