PHPackages                             nahid/request-proxy - 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. nahid/request-proxy

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

nahid/request-proxy
===================

Request proxy library helps you to proxy your request to another server

12281PHP

Since Apr 4Pushed 3y agoCompare

[ Source](https://github.com/nahid/php-request-proxy)[ Packagist](https://packagist.org/packages/nahid/request-proxy)[ RSS](/packages/nahid-request-proxy/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

PHP Request Proxy
=================

[](#php-request-proxy)

> This package is forked from `jenssegers/php-proxy` and modified. It is not compatible with the original package. Basically the original package is not maintained anymore thats why I forked it.

This is a HTTP/HTTPS proxy script that forwards requests to a different server and returns the response. The Proxy class uses PSR7 request/response objects as input/output, and uses Guzzle to do the actual HTTP request.

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

[](#installation)

Install using composer:

```
composer require nahid/request-proxy

```

Example
-------

[](#example)

The following example creates a request object, based on the current browser request, and forwards it to `example.com`. The `RemoveEncodingFilter` removes the encoding headers from the original response so that the current webserver can set these correctly.

```
use Nahid\RequestProxy\Proxy;
use Nahid\RequestProxy\Adapter\Guzzle\GuzzleAdapter;
use Nahid\RequestProxy\Filter\RemoveEncodingFilter;
use Laminas\Diactoros\ServerRequestFactory;

// Create a PSR7 request based on the current browser request.
$request = ServerRequestFactory::fromGlobals();

// Create a guzzle client
$guzzle = new GuzzleHttp\Client();

// Create the proxy instance
$proxy = new Proxy(new GuzzleAdapter($guzzle));

// Add a response filter that removes the encoding headers.
$proxy->filter(new RemoveEncodingFilter());

try {
    // Forward the request and get the response.
    $response = $proxy->forward($request)->to('http://example.com');

    // Output response to the browser.
    (new Laminas\HttpHandlerRunner\Emitter\SapiEmitter)->emit($response);
} catch(\GuzzleHttp\Exception\BadResponseException $e) {
    // Correct way to handle bad responses
    (new Laminas\HttpHandlerRunner\Emitter\SapiEmitter)->emit($e->getResponse());
}
```

Filters
-------

[](#filters)

You can apply filters to the requests and responses using the middleware strategy:

```
$response = $proxy
	->forward($request)
	->filter(function ($request, $response, $next) {
		// Manipulate the request object.
		$request = $request->withHeader('User-Agent', 'FishBot/1.0');

		// Call the next item in the middleware.
		$response = $next($request, $response);

		// Manipulate the response object.
		$response = $response->withHeader('X-Proxy-Foo', 'Bar');

		return $response;
	})
	->to('http://example.com');
```

###  Health Score

19

—

LowBetter than 9% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity23

Early-stage or recently created project

 Bus Factor1

Top contributor holds 71.6% 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://avatars.githubusercontent.com/u/3167309?v=4)[Nahid Bin Azhar](/maintainers/nahid)[@nahid](https://github.com/nahid)

---

Top Contributors

[![jenssegers](https://avatars.githubusercontent.com/u/194377?v=4)](https://github.com/jenssegers "jenssegers (83 commits)")[![jmolivas](https://avatars.githubusercontent.com/u/366275?v=4)](https://github.com/jmolivas "jmolivas (8 commits)")[![nahid](https://avatars.githubusercontent.com/u/3167309?v=4)](https://github.com/nahid "nahid (5 commits)")[![staabm](https://avatars.githubusercontent.com/u/120441?v=4)](https://github.com/staabm "staabm (4 commits)")[![jmortlock](https://avatars.githubusercontent.com/u/10041761?v=4)](https://github.com/jmortlock "jmortlock (3 commits)")[![abm-devmonk-purple](https://avatars.githubusercontent.com/u/18488288?v=4)](https://github.com/abm-devmonk-purple "abm-devmonk-purple (3 commits)")[![developarts](https://avatars.githubusercontent.com/u/3060193?v=4)](https://github.com/developarts "developarts (2 commits)")[![abdullah-ctl](https://avatars.githubusercontent.com/u/45127367?v=4)](https://github.com/abdullah-ctl "abdullah-ctl (1 commits)")[![vundb](https://avatars.githubusercontent.com/u/3923907?v=4)](https://github.com/vundb "vundb (1 commits)")[![ab-kily](https://avatars.githubusercontent.com/u/9202344?v=4)](https://github.com/ab-kily "ab-kily (1 commits)")[![alexandrusavin](https://avatars.githubusercontent.com/u/1612455?v=4)](https://github.com/alexandrusavin "alexandrusavin (1 commits)")[![fabrizim](https://avatars.githubusercontent.com/u/79165?v=4)](https://github.com/fabrizim "fabrizim (1 commits)")[![jsor](https://avatars.githubusercontent.com/u/55574?v=4)](https://github.com/jsor "jsor (1 commits)")[![mcg-web](https://avatars.githubusercontent.com/u/1496283?v=4)](https://github.com/mcg-web "mcg-web (1 commits)")[![Remo](https://avatars.githubusercontent.com/u/129864?v=4)](https://github.com/Remo "Remo (1 commits)")

### Embed Badge

![Health badge](/badges/nahid-request-proxy/health.svg)

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

###  Alternatives

[php-http/cache-plugin

PSR-6 Cache plugin for HTTPlug

25126.1M82](/packages/php-http-cache-plugin)[illuminate/http

The Illuminate Http package.

11937.9M6.9k](/packages/illuminate-http)[rdkafka/rdkafka

A PHP extension for Kafka

2.2k24.3k1](/packages/rdkafka-rdkafka)[httpsoft/http-message

Strict and fast implementation of PSR-7 and PSR-17

87965.9k114](/packages/httpsoft-http-message)[mezzio/mezzio-router

Router subcomponent for Mezzio

265.4M91](/packages/mezzio-mezzio-router)[serpapi/google-search-results-php

Get Google, Bing, Baidu, Ebay, Yahoo, Yandex, Home depot, Naver, Apple, Duckduckgo, Youtube search results via SerpApi.com

69127.2k](/packages/serpapi-google-search-results-php)

PHPackages © 2026

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