定制 tuupola/http-factory 二次开发

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

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

tuupola/http-factory

最新稳定版本:1.4.0

Composer 安装命令:

composer require tuupola/http-factory

包简介

Lightweight autodiscovering PSR-17 HTTP factories

README 文档

README

Latest Version Software License Build Status Coverage

Install

Install the library using Composer.

$ composer require tuupola/http-factory

Usage

Let's assume you have Diactoros installed.

$ composer require zendframework/zend-diactoros

The factories will now automatically return Diactoros PSR-7 instances.

use Tuupola\Http\Factory\RequestFactory;

$request = (new RequestFactory)->createRequest("GET", "https://example.com/");
print get_class($request); /* Zend\Diactoros\Request */

On the other hand if you have Slim frameworks installed.

$ composer remove zendframework/zend-diactoros
$ composer require slim/slim

The factories will now return Slim PSR-7 instances.

use Tuupola\Http\Factory\RequestFactory;

$request = (new RequestFactory)->createRequest("GET", "https://example.com/");
print get_class($request); /* Slim\Http\Request */

This library currently automatically detects and supports laminas/laminas-diactoros, zendframework/zend-diactoros, slim/slim, slim/psr7, nyholm/psr7 and guzzle/psr7 PSR-7 implementations.

Testing

You can run tests either manually or automatically on every code change. Automatic tests require entr to work.

$ make test
$ brew install entr
$ make watch

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email tuupola@appelsiini.net instead of using the issue tracker.

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 3.92M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 17
  • 点击次数: 2
  • 依赖项目数: 17
  • 推荐数: 3

GitHub 信息

  • Stars: 17
  • Watchers: 1
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04