temant-framework/http-core 问题修复 & 功能扩展

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

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

temant-framework/http-core

最新稳定版本:v1.0.0

Composer 安装命令:

composer require temant-framework/http-core

包简介

PSR-7 & PSR-17 Implementation

README 文档

README

Packagist Version Packagist Downloads CI Status PHPStan Level Coverage

Temant HTTP Core is a lightweight implementation of the PSR-7 HTTP message interfaces and the PSR-17 HTTP message factory interfaces. It provides a clean and modern foundation for working with HTTP requests, responses, streams, URIs, and uploaded files in PHP.

The goal of this library is to offer a simple and standards-compliant package written for modern PHP without unnecessary overhead.

Features

  • Fully compliant with PSR-7 and PSR-17
  • Focused and minimal API surface
  • Immutable message objects
  • Supports all HTTP message components, including headers, bodies, uploaded files and URIs
  • Tested and analyzed with PHPUnit and PHPStan

Requirements

  • PHP 8.4 or higher
  • psr/http-message ^2.0
  • psr/http-factory ^1.1

Installation

Install via Composer:

composer require temant/http-core

Usage Example

<?php

declare(strict_types=1);

require_once __DIR__ . "/vendor/autoload.php";

use Temant\HttpCore\Factory\RequestFactory;
use Temant\HttpCore\Factory\ResponseFactory;
use Temant\HttpCore\Factory\StreamFactory;

// Create a request instance
$request = new RequestFactory()
    ->createRequest('GET', 'https://example.com');

// Create a response with text content
$stream = new StreamFactory()
    ->createStream('Hello Temant');

$response = new ResponseFactory()
    ->createResponse()
    ->withBody($stream);

echo $response->getStatusCode(); // 200
echo $response->getBody();       // Hello Temant

Additional examples for headers, query parameters, uploaded files, and streams will be added soon.

Development

Run the test suite:

composer test

Run static analysis:

composer analyse

This library is compatible with the official http-interop/http-factory-tests.

Project Structure

Src/
Tests/
composer.json

Autoloading follows PSR-4 for both source and test directories.

Contributing

Contributions are welcome. Please ensure that new code includes relevant tests. Bug reports and improvement suggestions are appreciated.

License

Temant HTTP Core is open-sourced software licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-10-27