francerz/http-utils 问题修复 & 功能扩展

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

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

francerz/http-utils

最新稳定版本:v0.2.66

Composer 安装命令:

composer require francerz/http-utils

包简介

PHP HTTP utils compatible with PSR-7, PSR-17

README 文档

README

PHP HTTP utils library that supports PSR-7 and PSR-17 with basic helpers and common operations.

Installation

Using composer.

composer require francerz/http-utils

Featured functionality

HttpFactoryManager class

Preserve per instance, reference of PSR-17 Factories (psr/http-factory). Uses set and get methods to manage existing factory instances.

Individual setter methods

  • setRequestFactory(RequestFactoryInterface $requestFactory)
  • setResponseFactory(ResponseFactoryInterface $responseFactory)
  • setServerRequestFactory(ServerRequestFactoryInterface $serverRequestFactory)
  • setStreamFactory(StreamFactoryInterface $streamFactory)
  • setUploadedFileFactory(UploadedFileFactoryInterface $uploadedFileFactory)
  • setUriFactory(UriFactoryInterface $uriFactory)

Getter methods

Getter Methods will throw a LogicException if not factory has been set previously.

  • getRequestFactory() : RequestFactoryInterface
  • getResponseFactory() : ResponseFactoryInterface
  • getServerRequestFactory() : ServerRequestFactoryInterface
  • getStreamFactory() : StreamFactoryInterface
  • getUploadedFileFactory() : UploadedFileFactoryInterface
  • getUriFactory() : UriFactoryInterface

Automatic setter method

The method setMatchingFactories($factoryObject) receives an object and checks implementation of each Factory Interface. All matching interfaces will be set.

This method is included on the constructor to quick factory setting.

UriHelper class

Provides methods for common manipulation to UriInterface objects.

Creating uri of current request

  • getCurrent(UriFactoryInterface $uriFactory) : UriInterface

Path part manipulation

  • appendPath(UriInterface $uri, string $postpath) : UriInterface
  • prependPath(UriInterface $uri, string $prepath) : UriInterface

Query part manipulation

  • withQueryParams(UriInterface $uri, string $key, $value) : UriInterface
  • withQueryParams(UriInterface $uri, array $params, $replace = true) : UriInterface
  • withoutQueryParam(UriInterface $uri, string $key, &$value = null) : UriInterface
  • getQueryParams(UriInterface $uri) : array
  • getQueryParam(UriInterface $uri, string $key) : ?string

Fragment part manipulation

  • withFragmentParam(UriInterface $uri, string $key, $value) : UriInterface
  • withFragmentParams(UriInterface $uri, array $params, $replace = true) : UriInterface
  • withoutFragmentParam(UriInterface $uri, string $key, &$value = null) : UriInterface
  • getFragmentParams(UriInterface $uri) : array
  • getFragmentParam(UriInterface $uri, string $key) : ?string

MessageHelper class

Provides methods for common manipulation to MessageInterface objects.

Helper setup

  • setHttpFactoryManager(HttpFactoryManager $factories)
  • setAuthenticationSchemes(array $authenticationSchemeClasses)

Creating a request object from server parameters

  • getCurrentRequest() : RequestInterface

Handling message headers

  • getAuthorizationHeader(MessageInterface $message) : ?AbstractAuthorizationHeader

Parsing body message content based on Content-Type header

  • getContent(MessageInterface $message)
  • withContent(MessageInterface $message, string $mediaType, $content) : MessageInterface

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-10-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固