PHPackages                             componenta/http - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. componenta/http

ActiveLibrary[HTTP &amp; Networking](/categories/http)

componenta/http
===============

HTTP abstractions and PSR helpers for Componenta

v1.0.0(1mo ago)083MITPHPPHP ^8.4

Since Jun 16Pushed 1mo agoCompare

[ Source](https://github.com/componenta/http)[ Packagist](https://packagist.org/packages/componenta/http)[ RSS](/packages/componenta-http/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)DependenciesVersions (2)Used By (3)

Componenta HTTP
===============

[](#componenta-http)

Minimal HTTP primitives shared by Componenta HTTP packages.

This package intentionally has no PSR-7 implementation, PSR-17 factory, middleware, responder, request creator, emitter, router, or application runtime. Those pieces live in separate packages so `componenta/http` can stay dependency-free.

Package Boundary
----------------

[](#package-boundary)

Included hereProvided by another package`Componenta\Http\HttpMethod` value object.PSR-7 request/response implementations are installed through `componenta/http-psr-*` integration packages.`Componenta\Http\Header` constants.PSR request creation is in `componenta/http-psr`.HTTP exception classes and `HttpExceptionFactory`.Response building is in `componenta/http-responder`.No runtime wiring or config provider.Response emission is in `componenta/http-emitter`.Middleware is split into `componenta/http-body-parsing-middleware`, `componenta/http-cors-middleware`, `componenta/http-csrf-middleware`, `componenta/http-throttle-middleware`, and `componenta/http-trusted-proxy-middleware`.Pagination URL helpers are in `componenta/http-pagination`.Installation
------------

[](#installation)

```
composer require componenta/http
```

Requirements
------------

[](#requirements)

- PHP `^8.4`

The package has no Composer dependencies.

HTTP Method
-----------

[](#http-method)

`HttpMethod` normalizes method names and exposes RFC-oriented properties for common routing and middleware decisions.

```
use Componenta\Http\HttpMethod;

$method = HttpMethod::from('post');

$method->value;        // POST
$method->isSafe;       // false
$method->isIdempotent; // false
$method->isCacheable;  // false
$method->requiresBody; // true
```

Standard helpers are available for common methods:

```
HttpMethod::get();
HttpMethod::post();
HttpMethod::put();
HttpMethod::delete();
HttpMethod::patch();
```

Custom non-empty methods are allowed and normalized to uppercase. Use `HttpMethod::tryFrom()` when an empty value should return `null` instead of throwing.

Header Constants
----------------

[](#header-constants)

`Header` groups common HTTP header names as constants and includes helper lists for request, response, security, cache, and CORS headers.

```
use Componenta\Http\Header;

$response = $response->withHeader(Header::CONTENT_TYPE, 'application/json');

Header::isRequestHeader(Header::AUTHORIZATION); // true
Header::getSecurityHeaders();                   // list
```

The class is a static helper and is not meant to be instantiated.

HTTP Exceptions
---------------

[](#http-exceptions)

All status-specific exceptions extend `Componenta\Http\Exception\HttpException`.

```
use Componenta\Http\Exception\NotFoundException;

throw new NotFoundException('Post not found');
```

`HttpException` exposes:

APIMeaning`$exception->statusCode`HTTP status code.`$exception->headers`Headers that an HTTP error response generator may copy to the response.`withHeader(string $name, stringarray $value)`Use `HttpExceptionFactory::fromStatusCode()` when the status code is known only at runtime.

```
use Componenta\Http\Exception\HttpExceptionFactory;

$exception = HttpExceptionFactory::fromStatusCode(409, 'Revision conflict');
```

`HttpExceptionFactory::isClientError()` and `HttpExceptionFactory::isServerError()` classify existing `HttpException` instances.

Some status-specific exceptions also store data that is needed to build a correct HTTP response:

ExceptionExtra behavior`UnauthorizedException::basic()` / `UnauthorizedException::bearer()`Adds the `WWW-Authenticate` header.`MethodNotAllowedException`Requires the allowed methods list and adds the `Allow` header.`ContentTooLargeException`, `TooManyRequestsException`, `ServiceUnavailableException`Accept an optional retry delay and add `Retry-After`.`ServiceUnavailableException::maintenance()`Calculates `Retry-After` from a maintenance end time.`RangeNotSatisfiableException`Requires the total resource size and adds `Content-Range`.`UpgradeRequiredException`Requires the target protocol and adds `Upgrade`.`HttpExceptionFactory::fromStatusCode()` creates generic instances. Prefer the concrete constructors above when the response must include these headers.

Related Packages
----------------

[](#related-packages)

PackageResponsibility[`componenta/http-psr`](../http-psr/README.md)Creates PSR-7 server requests through configured factories.[`componenta/http-responder`](../http-responder/README.md)Builds PSR-7 responses from common PHP values.[`componenta/http-emitter`](../http-emitter/README.md)Emits PSR-7 responses to PHP output.[`componenta/app-http`](../app-http/README.md)Runs Componenta HTTP applications.

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance91

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

43d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/20490712?v=4)[Andrey Shelamkoff](/maintainers/Shelamkoff)[@Shelamkoff](https://github.com/Shelamkoff)

---

Top Contributors

[![Shelamkoff](https://avatars.githubusercontent.com/u/20490712?v=4)](https://github.com/Shelamkoff "Shelamkoff (1 commits)")

### Embed Badge

![Health badge](/badges/componenta-http/health.svg)

```
[![Health](https://phpackages.com/badges/componenta-http/health.svg)](https://phpackages.com/packages/componenta-http)
```

###  Alternatives

[php-http/cache-plugin

PSR-6 Cache plugin for HTTPlug

25026.1M82](/packages/php-http-cache-plugin)[httpsoft/http-message

Strict and fast implementation of PSR-7 and PSR-17

87965.9k124](/packages/httpsoft-http-message)[serpapi/google-search-results-php

Get Google, Bing, Baidu, Ebay, Yahoo, Yandex, Home depot, Naver, Apple, Duckduckgo, Youtube search results via SerpApi.com

69127.2k](/packages/serpapi-google-search-results-php)[thesis/nats

Async (fiber based) client for Nats.

754.4k](/packages/thesis-nats)[jasny/http-signature

Implementation of the IETF HTTP Signatures draft RFC

10104.7k](/packages/jasny-http-signature)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
