定制 fast-forward/http-factory 二次开发

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

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

fast-forward/http-factory

最新稳定版本:v1.1.1

Composer 安装命令:

composer require fast-forward/http-factory

包简介

Fast Forward PSR-7 HTTP Factory utility classes

README 文档

README

PHP Version License CI

A PSR-11 compatible service provider that registers a fully functional set of PSR-17 and PSR-7 HTTP factories using Nyholm PSR-7 and Nyholm ServerRequestCreator.

Designed to work out of the box with the php-fast-forward/container autowiring system.

📦 Installation

composer require fast-forward/http-factory

✅ Features

  • Registers the Psr17Factory as the base implementation for all PSR-17 interfaces
  • Registers the ServerRequestCreator using InvokableFactory
  • Provides ServerRequestInterface::class using fromGlobals() via MethodFactory
  • Aliases:
    • RequestFactoryInterface
    • ResponseFactoryInterface
    • ServerRequestFactoryInterface
    • StreamFactoryInterface
    • UploadedFileFactoryInterface
    • UriFactoryInterface

🛠️ Usage

If you’re using fast-forward/container:

use FastForward\Container\container;
use FastForward\Config\ArrayConfig;
use FastForward\Container\ContainerInterface;

$config = new ArrayConfig([
    ContainerInterface::class => [
        // Reference the service provider by class name
        HttpMessageFactoryServiceProvider::class,
    ],
]);

$container = container($config);

$requestFactory = $container->get(Psr\Http\Message\RequestFactoryInterface::class);
$serverRequest = $container->get(Psr\Http\Message\ServerRequestInterface::class);

🔧 Services Registered

The following services will be automatically registered in your container when using HttpMessageFactoryServiceProvider:

Service Interface Implementation Source
Psr\Http\Message\RequestFactoryInterface Nyholm\Psr7\Factory\Psr17Factory (via alias)
Psr\Http\Message\ResponseFactoryInterface Nyholm\Psr7\Factory\Psr17Factory (via alias)
Psr\Http\Message\ServerRequestFactoryInterface Nyholm\Psr7\Factory\Psr17Factory (via alias)
Psr\Http\Message\StreamFactoryInterface Nyholm\Psr7\Factory\Psr17Factory (via alias)
Psr\Http\Message\UploadedFileFactoryInterface Nyholm\Psr7\Factory\Psr17Factory (via alias)
Psr\Http\Message\UriFactoryInterface Nyholm\Psr7\Factory\Psr17Factory (via alias)
Nyholm\Psr7\Factory\Psr17Factory Registered via InvokableFactory
Nyholm\Psr7Server\ServerRequestCreator Registered via InvokableFactory, with dependencies
Psr\Http\Message\ServerRequestInterface Created by calling fromGlobals() on ServerRequestCreator via MethodFactory

📂 License

This package is open-source software licensed under the MIT License.

🤝 Contributing

Contributions, issues, and feature requests are welcome!
Feel free to open a GitHub Issue or submit a Pull Request.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-08-01