temant-framework/http-core

PSR-7 & PSR-17 Implementation

Installs: 2

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/temant-framework/http-core

v1.0.0 2025-10-27 19:26 UTC

This package is not auto-updated.

Last update: 2025-11-11 18:05:20 UTC


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.