PHPackages                             akrabat/proxy-detection-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. akrabat/proxy-detection-middleware

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

akrabat/proxy-detection-middleware
==================================

PSR-7/PSR-15 Middleware that determines the scheme, host and port from the 'X-Forwarded-Proto', 'X-Forwarded-Host' and 'X-Forwarded-Port' headers and updates the Request's Uri object.

1.1(1y ago)3190.4k↑60.9%81BSD-3-ClausePHP

Since Nov 1Pushed 1y ago4 watchersCompare

[ Source](https://github.com/akrabat/proxy-detection-middleware)[ Packagist](https://packagist.org/packages/akrabat/proxy-detection-middleware)[ Docs](http://github.com/akrabat/proxy-detection-middleware)[ RSS](/packages/akrabat-proxy-detection-middleware/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (5)Versions (7)Used By (1)

Proxy Scheme, Host and Port detection middleware
================================================

[](#proxy-scheme-host-and-port-detection-middleware)

PSR-15 Middleware that determines the scheme, host and port from the 'X-Forwarded-Proto', 'X-Forwarded-Host' and 'X-Forwarded-Port' headers and updates the Request's Uri object.

You can set a list of proxies that are trusted as the second constructor parameter. If this list is set, then the proxy headers will only be checked if the `REMOTE_ADDR` is in the trusted list.

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

[](#installation)

`composer require akrabat/proxy-detection-middleware`

Usage
-----

[](#usage)

In Slim 3:

```
$trustedProxies = ['10.0.0.1', '10.0.0.2'];
$app->add(new RKA\Middleware\ProxyDetection($trustedProxies));

$app->get('/', function ($request, $response, $args) {
    $scheme = $request->getUri()->getScheme();
    $host = $request->getUri()->getHost();
    $port = $request->getUri()->getPort();

    return $response;
});
```

Testing
-------

[](#testing)

- Code coverage: `$ vendor/bin/phpcs`
- Unit tests: `$ vendor/bin/phpunit`
- Code coverage: `$ vendor/bin/phpunit --coverage-html ./build`

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity44

Moderate usage in the ecosystem

Community20

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 74.3% 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 ~661 days

Recently: every ~784 days

Total

6

Last Release

543d ago

Major Versions

0.4 → 1.02023-02-17

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/33135?v=4)[Rob Allen](/maintainers/akrabat)[@akrabat](https://github.com/akrabat)

---

Top Contributors

[![akrabat](https://avatars.githubusercontent.com/u/33135?v=4)](https://github.com/akrabat "akrabat (26 commits)")[![darxriggs](https://avatars.githubusercontent.com/u/16874?v=4)](https://github.com/darxriggs "darxriggs (4 commits)")[![vlakoff](https://avatars.githubusercontent.com/u/544424?v=4)](https://github.com/vlakoff "vlakoff (3 commits)")[![esetnik](https://avatars.githubusercontent.com/u/664434?v=4)](https://github.com/esetnik "esetnik (1 commits)")[![flavioheleno](https://avatars.githubusercontent.com/u/471860?v=4)](https://github.com/flavioheleno "flavioheleno (1 commits)")

---

Tags

middlewarepsr7IP

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/akrabat-proxy-detection-middleware/health.svg)

```
[![Health](https://phpackages.com/badges/akrabat-proxy-detection-middleware/health.svg)](https://phpackages.com/packages/akrabat-proxy-detection-middleware)
```

###  Alternatives

[akrabat/ip-address-middleware

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

1702.5M18](/packages/akrabat-ip-address-middleware)[mezzio/mezzio-authentication-oauth2

OAuth2 (server) authentication middleware for Mezzio and PSR-7 applications.

28483.0k2](/packages/mezzio-mezzio-authentication-oauth2)[mezzio/mezzio-authentication

Authentication middleware for Mezzio and PSR-7 applications

121.6M26](/packages/mezzio-mezzio-authentication)[jimtools/jwt-auth

PSR-15 JWT Authentication middleware, A replacement for tuupola/slim-jwt-auth

20142.3k3](/packages/jimtools-jwt-auth)[middlewares/client-ip

Middleware to detect the client ip and save it as a request attribute

16629.7k9](/packages/middlewares-client-ip)[middlewares/firewall

Middleware to provide IP filtering

12318.3k2](/packages/middlewares-firewall)

PHPackages © 2026

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