PHPackages                             webignition/guzzle-request-headers-middleware - 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. webignition/guzzle-request-headers-middleware

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

webignition/guzzle-request-headers-middleware
=============================================

Middleware for setting headers on all requests sent by a Guzzle 6 client

0.2(7y ago)142.0kMITPHPPHP &gt;=7.2.0

Since May 14Pushed 7y ago2 watchersCompare

[ Source](https://github.com/webignition/guzzle-request-headers-middleware)[ Packagist](https://packagist.org/packages/webignition/guzzle-request-headers-middleware)[ Docs](https://github.com/webignition/guzzle-request-headers-middleware)[ RSS](/packages/webignition-guzzle-request-headers-middleware/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (6)Versions (3)Used By (0)

Guzzle Request Headers Middleware
=================================

[](#guzzle-request-headers-middleware)

Overview
--------

[](#overview)

[Middleware](http://docs.guzzlephp.org/en/stable/handlers-and-middleware.html#middleware) for [Guzzle 6](http://docs.guzzlephp.org/en/stable/) for setting headers on all requests sent by a client.

Add any number of headers to every request sent by a client. That's it. Easy.

Usage example
-------------

[](#usage-example)

```
use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;
use webignition\Guzzle\Middleware\RequestHeaders\RequestHeadersMiddleware;

// Creating a client that uses the middleware
$requestHeadersMiddleware = new RequestHeadersMiddleware();

$handlerStack = HandlerStack::create();
$handlerStack->push($requestHeadersMiddleware, 'request-headers');

$client = new Client([
    'handler' => $handlerStack,
]);

// Setting request headers
$requestHeadersMiddleware->setHeader('User-Agent', 'Super Foo!');

// All requests to example.com (or *.example.com) will now have
// a header of 'User-Agent: Super Foo!'

// Clearing request headers by explicitly setting a previously-set value to null
$requestHeadersMiddleware->setHeader('User-Agent', null);
```

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity49

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 ~315 days

Total

2

Last Release

2657d ago

PHP version history (2 changes)0.1PHP &gt;=5.6.0

0.2PHP &gt;=7.2.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/278be37d1b614ef0c40b22b777663e545a1f6d69dd4f908888cbb557ad7e608f?d=identicon)[webignition](/maintainers/webignition)

---

Top Contributors

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

---

Tags

middlewareGuzzlepsr7headers

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/webignition-guzzle-request-headers-middleware/health.svg)

```
[![Health](https://phpackages.com/badges/webignition-guzzle-request-headers-middleware/health.svg)](https://phpackages.com/packages/webignition-guzzle-request-headers-middleware)
```

###  Alternatives

[guzzlehttp/psr7

PSR-7 message implementation that also provides common utility methods

8.0k1.1B4.0k](/packages/guzzlehttp-psr7)[kevinrob/guzzle-cache-middleware

A HTTP/1.1 Cache for Guzzle 6. It's a simple Middleware to be added in the HandlerStack. (RFC 7234)

44018.6M133](/packages/kevinrob-guzzle-cache-middleware)[mezzio/mezzio

PSR-15 Middleware Microframework

3923.8M126](/packages/mezzio-mezzio)[rtheunissen/guzzle-log-middleware

Guzzle middleware to log requests and responses

822.3M17](/packages/rtheunissen-guzzle-log-middleware)[akrabat/ip-address-middleware

PSR-15 middleware that determines the client IP address and stores it as a ServerRequest attribute

1722.6M24](/packages/akrabat-ip-address-middleware)[telnyx/telnyx-php

Official Telnyx PHP SDK — APIs for Voice, SMS, MMS, WhatsApp, Fax, SIP Trunking, Wireless IoT, Call Control, and more. Build global communications on Telnyx's private carrier-grade network.

35789.4k2](/packages/telnyx-telnyx-php)

PHPackages © 2026

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