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

ActiveLibrary

dxdo/proxy-detection
====================

PSR-7 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.

0127PHP

Since Feb 9Pushed 5y ago1 watchersCompare

[ Source](https://github.com/dxdo/proxy-detection)[ Packagist](https://packagist.org/packages/dxdo/proxy-detection)[ RSS](/packages/dxdo-proxy-detection/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependenciesVersions (1)Used By (0)

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

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

PSR-7 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.

Based on `akrabat/proxy-detection-middleware`. It uses PHPUnit 5 and supports PHP 5.6.

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

[](#installation)

`composer require wellingguzman/proxy-detection`

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

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity31

Early-stage or recently created project

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/e62a50dd8b389ce73c40a44c3817f6027936e6b22b04474e8243cfb947373a22?d=identicon)[dxdo](/maintainers/dxdo)

### Embed Badge

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

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

PHPackages © 2026

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