PHPackages                             vendor-patch/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. vendor-patch/proxy

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

vendor-patch/proxy
==================

Proxy library that forwards requests to the desired url and returns the response.

011PHP

Since Sep 1Pushed 1y agoCompare

[ Source](https://github.com/vendor-patch/php-proxy)[ Packagist](https://packagist.org/packages/vendor-patch/proxy)[ RSS](/packages/vendor-patch-proxy/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (1)

PHP Proxy
=========

[](#php-proxy)

[![Build Status](https://camo.githubusercontent.com/40c802aa1b16d121cd23a0b30c7e510546e01e8d6d289f260f01bd6a5a8d70e3/687474703a2f2f696d672e736869656c64732e696f2f7472617669732f6a656e737365676572732f7068702d70726f78792e737667)](https://travis-ci.org/jenssegers/php-proxy) [![Coverage Status](https://camo.githubusercontent.com/1d330a96cf6f90714fac80caa82f2e3e4f7292f3a097f6d90b97b29e283f6bd8/687474703a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f6a656e737365676572732f7068702d70726f78792e737667)](https://coveralls.io/r/jenssegers/php-proxy?branch=master)

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 jenssegers/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 Proxy\Proxy;
use Proxy\Adapter\Guzzle\GuzzleAdapter;
use Proxy\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

15

—

LowBetter than 3% of packages

Maintenance27

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity18

Early-stage or recently created project

 Bus Factor1

Top contributor holds 74.8% 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/67333?v=4)[webfan](/maintainers/webfan)[@webfan](https://github.com/webfan)

---

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)")[![staabm](https://avatars.githubusercontent.com/u/120441?v=4)](https://github.com/staabm "staabm (4 commits)")[![abm-devmonk-purple](https://avatars.githubusercontent.com/u/18488288?v=4)](https://github.com/abm-devmonk-purple "abm-devmonk-purple (3 commits)")[![jmortlock](https://avatars.githubusercontent.com/u/10041761?v=4)](https://github.com/jmortlock "jmortlock (3 commits)")[![developarts](https://avatars.githubusercontent.com/u/3060193?v=4)](https://github.com/developarts "developarts (2 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)")[![wehowski](https://avatars.githubusercontent.com/u/2658030?v=4)](https://github.com/wehowski "wehowski (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/vendor-patch-proxy/health.svg)

```
[![Health](https://phpackages.com/badges/vendor-patch-proxy/health.svg)](https://phpackages.com/packages/vendor-patch-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.4M92](/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)
