PHPackages                             ioflair/php-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. ioflair/php-proxy

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

ioflair/php-proxy
=================

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

v4.0.2(2y ago)04.4k↓43.8%11MITPHPPHP ^7.3|^8.0

Since Aug 10Pushed 2y agoCompare

[ Source](https://github.com/ioflair/php-proxy)[ Packagist](https://packagist.org/packages/ioflair/php-proxy)[ Docs](https://github.com/ioflair/php-proxy)[ RSS](/packages/ioflair-php-proxy/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (8)Versions (17)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 ioflair/php-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

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 68.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.

###  Release Activity

Cadence

Every ~253 days

Recently: every ~370 days

Total

14

Last Release

1001d ago

Major Versions

v2.2.1 → v3.0.0-beta2015-10-05

v3.1.0 → v4.0.02022-06-29

PHP version history (2 changes)v3.0.1PHP ^5.6 || ^7.0

v4.0.0PHP ^7.3|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6048614?v=4)[Péter Nyári](/maintainers/netwarex)[@netwarex](https://github.com/netwarex)

---

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)")[![Riversedgedesigns](https://avatars.githubusercontent.com/u/21132665?v=4)](https://github.com/Riversedgedesigns "Riversedgedesigns (5 commits)")[![netwarex](https://avatars.githubusercontent.com/u/6048614?v=4)](https://github.com/netwarex "netwarex (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)")[![vundb](https://avatars.githubusercontent.com/u/3923907?v=4)](https://github.com/vundb "vundb (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)")[![kovesdieszter](https://avatars.githubusercontent.com/u/88904589?v=4)](https://github.com/kovesdieszter "kovesdieszter (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)")[![ab-kily](https://avatars.githubusercontent.com/u/9202344?v=4)](https://github.com/ab-kily "ab-kily (1 commits)")

---

Tags

proxy

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ioflair-php-proxy/health.svg)

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

###  Alternatives

[jenssegers/proxy

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

940487.2k4](/packages/jenssegers-proxy)[rareloop/lumberjack-core

A powerful MVC framework for the modern WordPress developer. Write better, more expressive and easier to maintain code

42155.0k19](/packages/rareloop-lumberjack-core)[remic/guzzlecache

Laravel 5 package for caching Guzzle's GET requests.

189.3k](/packages/remic-guzzlecache)[behamin/service-proxy

for proxy or sending requests to other services with useful utilities

102.2k](/packages/behamin-service-proxy)

PHPackages © 2026

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