定制 free-elephants/static-http-client 二次开发

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

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

free-elephants/static-http-client

最新稳定版本:0.0.3

Composer 安装命令:

composer require free-elephants/static-http-client

包简介

PSR-18 implementation for work with file fixtures

README 文档

README

PSR-18 implementation for testing. Use static files for mock responses and write requests.

Installation

composer require free-elephants/static-http-client --dev

Usage

See tests for more examples.

public function test()
{
    $stubbedHttpClient = new \FreeElephants\StaticHttpClient\StaticHttpClient(
        $responseFactory, 
        new \FreeElephants\StaticHttpClient\PathResolver\PathBuilderBasedResolver(
            new \FreeElephants\StaticHttpClient\PathBuilder\Composite(
                new \FreeElephants\StaticHttpClient\PathBuilder\PrependBasePath(__DIR__),
                new \FreeElephants\StaticHttpClient\PathBuilder\PrependHostnameAsDirectory(),
                new \FreeElephants\StaticHttpClient\PathBuilder\AppendRequestPath(),
                new \FreeElephants\StaticHttpClient\PathBuilder\AppendDefaultFileExtension('.json'),
            ) 
        )
    );
    
    $response = $stubbedHttpClient->sendRequest(new \Nyholm\Psr7\Request('GET', 'https://example.com/foo')); // resolved as __DIR__ . '/example.com/foo.json'  
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2025-04-22