PHPackages                             http-php/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. [HTTP &amp; Networking](/categories/http)
4. /
5. http-php/headers

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

http-php/headers
================

A simple OOP wrapper to work with HTTP headers in PHP

417PHP

Since Jul 26Pushed 3y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Headers
=======

[](#headers)

[![Latest Version](https://camo.githubusercontent.com/03f54ab71ca65e4fb3198ad77dba294c79e686bc2dad39e211bd4ae3536cd587/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f687474702d7068702f686561646572732e7376673f7374796c653d666c61742d737175617265266c6162656c3d72656c65617365)](https://packagist.org/packages/http-php/headers)[![PHP Version](https://camo.githubusercontent.com/ce9095c821a920909ef00ebd90e06e721b06e06acd50aa8e17678e24f21f76fa/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f687474702d7068702f686561646572732e7376673f7374796c653d666c61742d737175617265)](https://php.net)[![Tests](https://github.com/http-php/headers/actions/workflows/test.yml/badge.svg)](https://github.com/http-php/headers/actions/workflows/test.yml)[![Total Downloads](https://camo.githubusercontent.com/8bfc614f09144c33c3cbe7ea05123da98d6284ceb35e9f27ca245598cd86804a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f687474702d7068702f686561646572732e7376673f7374796c653d666c61742d73717561726526636f6c6f72423d6d656469756d76696f6c6574726564)](https://packagist.org/packages/http-php/headers)

This package is to allow you to create HTTP Headers in PHP, in a simple and reliable way.

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

[](#installation)

```
composer require http-php/headers
```

Usage
-----

[](#usage)

To use this package, it is very simple. Create a header using the following code:

```
use HttpPHP\Headers\Header;

$header = Header::make(
    key: 'User-Agent',
    value: 'My-Awesome-Package',
);

$header->toHeader(); // ['User-Agent' => 'My-Awesome-Package'];
```

The package currently supports the following header value types:

- String
- Integer
- Float
- Boolean (although these will return 1 and 0)
- Arrays (these will return json encoded strings)
- Closures

It is important to note that if you pass a closure, that it must return something that can be cast to a string using `strval`.

Testing
-------

[](#testing)

To run the test suite:

```
composer run test
```

Credits
-------

[](#credits)

- [Steve McDougall](https://github.com/JustSteveKing)
- [All Contributors](../../contributors)

LICENSE
-------

[](#license)

The MIT LIcense (MIT). Please see [License File](./LICENSE) for more information.

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity25

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/a87fe82b349821ebd49cf57d65c4cd3e33ae0833222a8438d90fe8921ca899ea?d=identicon)[JustSteveKing](/maintainers/JustSteveKing)

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M319](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[nyholm/psr7

A fast PHP7 implementation of PSR-7

1.3k235.4M2.4k](/packages/nyholm-psr7)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M293](/packages/pusher-pusher-php-server)[spatie/crawler

Crawl all internal links found on a website

2.8k16.3M52](/packages/spatie-crawler)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78126.4M414](/packages/react-http)

PHPackages © 2026

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