phrity/http 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

phrity/http

最新稳定版本:1.1.0

Composer 安装命令:

composer require phrity/http

包简介

Utilities and interfaces for handling HTTP.

README 文档

README

Phrity Http

Build Status

Phrity Http

Utilities and interfaces for handling HTTP.

Installation

Install with Composer;

composer require phrity/http

HttpFactory

Convenience wrapper for HTTP factories, where you can add all or any factories to the same class. The class will then delegate to actual implementation. If any implementation is missing, a BadMethodCallException will be thrown.

Supports RequestFactoryInterface, ResponseFactoryInterface, ServerRequestFactoryInterface, StreamFactoryInterface, UploadedFileFactoryInterface and UriFactoryInterface from PSR-17.

$factory = new Phrity\Http\HttpFactory(
    requestFactory: $requestFactoryImplementation,
    responseFactory: $responseFactoryImplementation,
    serverRequestFactory: $serverRequestFactoryImplementation,
    streamFactory: $streamFactoryImplementation,
    uploadedFileFactory: $ruploadedFileFactoryImplementation,
    uriFactory: $uriFactoryImplementation,
);

Popular PSR-17 implementations, such as Nyholm and Guzzle, often offer factories that support all interfaces. By using the create() method, the HttpFactory can take any implementation and configure the HttpFactory class with the factories the implementation supports.

$guzzlePsr7 = new GuzzleHttp\Psr7\HttpFactory();
$factory = Phrity\Http\HttpFactory::create($guzzlePsr7);

Serializer

The serializer takes a PSR-7 HTTP Message and converts it to string. This string representation is a "raw" representation of HTTP request or response.

$serializer = new Serializer();
$request = $serializer->request($psrRequest);
$response = $serializer->response($psrResponse);
$message = $serializer->message($psrMessage);

Versions

Version PHP
1.1 ^8.1 Serializer; HTTP messages to string representation
1.0 ^8.1 HttpFactory convenience wrapper

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-09-07