PHPackages                             thesis/headers - 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. thesis/headers

ActiveLibrary

thesis/headers
==============

Typed headers for PHP.

0.1.0(today)11↑2900%MITPHPPHP ^8.4CI failing

Since Jul 31Pushed todayCompare

[ Source](https://github.com/thesis-php/headers)[ Packagist](https://packagist.org/packages/thesis/headers)[ Fund](https://www.tinkoff.ru/cf/5MqZQas2dk7)[ RSS](/packages/thesis-headers/feed)WikiDiscussions 0.1.x Synced today

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

Thesis Headers
==============

[](#thesis-headers)

Typed headers for PHP libraries and applications.

- Decode raw string headers into typed values
- Encode typed values back to wire-safe strings
- Preserve unknown or untouched raw values as-is
- Memoize decoded values
- Compose immutable header sets with `with()`, `without()` and `withMerged()`
- Built-in string, non-empty string, enum and time headers

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

[](#requirements)

- PHP 8.4+

Installation
------------

[](#installation)

```
composer require thesis/headers
```

Quick start
-----------

[](#quick-start)

Define headers once as constants and use them for typed reads and writes:

```
use Thesis\Headers;
use Thesis\Headers\BackedEnumHeader;
use Thesis\Headers\NonEmptyStringHeader;
use Thesis\Headers\TimeHeader;

enum ContentType: string
{
    case Html = 'text/html';
    case Json = 'application/json';
}

const CONTENT_TYPE = new BackedEnumHeader(ContentType::class, 'content-type');
const DATE = new TimeHeader('date', DATE_W3C);
const REQUEST_ID = new NonEmptyStringHeader('x-request-id');

$raw = [
    'content-type' => 'application/json',
    'date' => '2026-07-31T12:00:00+00:00',
];

$headers = new Headers($raw);

var_dump($headers->get(CONTENT_TYPE)); // ContentType::Json
var_dump($headers->get(DATE)); // DateTimeImmutable

$newHeaders = $headers
    ->with(CONTENT_TYPE, ContentType::Html) // replace header
    ->withDefault(REQUEST_ID, uniqid(...)) // set header only when missing
    ->without(DATE) // remove header
    ->withMerged($overrides) // merge, right side wins
;

var_dump($newHeaders->encode());
// [
//     'content-type' => 'text/html',
//     'x-request-id' => '6a6c90cae6b1d',
// ]
```

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance100

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity40

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

Every ~0 days

Total

2

Last Release

0d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2552865?v=4)[Valentin Udaltsov](/maintainers/vudaltsov)[@vudaltsov](https://github.com/vudaltsov)

---

Top Contributors

[![vudaltsov](https://avatars.githubusercontent.com/u/2552865?v=4)](https://github.com/vudaltsov "vudaltsov (6 commits)")

---

Tags

headershttpimmutablephpphp8protocol

### Embed Badge

![Health badge](/badges/thesis-headers/health.svg)

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

PHPackages © 2026

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