PHPackages                             redirectionio/proxy-sdk - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. redirectionio/proxy-sdk

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

redirectionio/proxy-sdk
=======================

PHP common code for redirection.io proxy

v0.4.0(6y ago)7145.8k12MITPHPPHP &gt;=5.6

Since Mar 23Pushed 5y ago6 watchersCompare

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

READMEChangelog (8)Dependencies (5)Versions (13)Used By (2)

redirection.io Proxy PHP SDK
============================

[](#redirectionio-proxy-php-sdk)

**\[DEPRECATED\]**: This library is deprecated and will not be maintained anymore. It does not work with the [current version of the redirection.io agent](https://redirection.io/documentation/developer-documentation/installation-of-the-agent), but only with the legacy 1.x branch. We advise you to migrate and use [one of the recommended integrations](https://redirection.io/documentation/developer-documentation/available-integrations#recommended-integrations).

[redirection.io](https://redirection.io) is a tool to track HTTP errors and setup useful HTTP redirections. It listens your website's HTTP traffic and logs every HTTP errors, so you can check that the project's redirection rules apply efficiently.

Quick demo (see below for detailed info):

```
$client = new RedirectionIO\Client\Sdk\Client($projectKey, $connections);
$request = new RedirectionIO\Client\Sdk\HttpMessage\Request(
    $_SERVER['HTTP_HOST'],
    $_SERVER['REQUEST_URI'],
    $_SERVER['HTTP_USER_AGENT'],
    $_SERVER['HTTP_REFERER']
);

$response = $client->request(new RedirectionIO\Client\Sdk\Command\MatchWithResponseCommand($request));

// There are no redirection for this Request
if (null === $response) {
    $response = '...'; // Handle your request with your application
}

$client->request(new RedirectionIO\Client\Sdk\Command\LogCommand($request, $response));

// Finally, Returns your response
```

Requirements
------------

[](#requirements)

- [Composer](https://getcomposer.org/)
- PHP 5.5+

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

[](#installation)

To use redirection.io in your project, add it to your composer.json file:

```
$ composer require redirectionio/proxy-sdk

```

Usage
-----

[](#usage)

### Instantiate Client

[](#instantiate-client)

Before starting, you need to instantiate a new Client.

```
use RedirectionIO\Client\Sdk\Client;

$client = new Client(string $projectKey, array $connections, int $timeout = 10000, bool $debug = false, LoggerInterface $logger = null);
```

Parameters:

- `$projectKey` your project key (can be found in redirection.io dashboard) ```
    $projectKey = 'szio2389-bfdz-51e8-8468-02dcop129501:ep6a4805-eo6z-dzo6-aeb0-8c1lbmo40242';
    ```
- `$connections` array of connection(s) parameters to the Agent(s) ```
    $connections = [
        'connection_tcp' => 'tcp://127.0.0.1:10301',
        'connection_unix' => 'unix:///var/run/redirectionio_agent.sock',
    ];
    ```
- `$timeout` timeout in microsecond for connection/request;
- `$debug` enable or disable debug mode. In debug mode an exception is thrown is something goes wrong, if not every errors is silenced;
- `\Psr\Log\LoggerInterface $logger` A logger.

### Find if a redirection rule exists

[](#find-if-a-redirection-rule-exists)

Check if request URI matches a redirect rule in the agent. If yes return a `RedirectResponse`, else return `null`.

```
use RedirectionIO\Client\Sdk\Client;
use RedirectionIO\Client\Sdk\HttpMessage\Request;
use RedirectionIO\Client\Sdk\Command\MatchCommand;

$client->request(new MatchWithResponseCommand(Request $request);
```

Parameter:

- `\RedirectionIO\Client\Sdk\HttpMessage\Request $request`.

Return values:

- `\RedirectionIO\Client\Sdk\HttpMessage\RedirectResponse $response` if agent has found a redirect rule for the current request uri;
- `null` if there isn't redirect rule set for the current uri in the agent.

### Find if a redirection rule exists for old agent (&lt;1.4.0)

[](#find-if-a-redirection-rule-exists-for-old-agent-140)

Check if request URI matches a redirect rule in the agent. If yes return a `RedirectResponse`, else return `null`.

This will also return null if the rule should have been matched against a Response Status Code. This is mainly for BC Compatibility and avoid old proxy to handle rules that it should not.

```
use RedirectionIO\Client\Sdk\Client;
use RedirectionIO\Client\Sdk\HttpMessage\Request;
use RedirectionIO\Client\Sdk\Command\MatchCommand;

$client->request(new MatchCommand(Request $request);
```

Parameter:

- `\RedirectionIO\Client\Sdk\HttpMessage\Request $request`.

Return values:

- `\RedirectionIO\Client\Sdk\HttpMessage\RedirectResponse $response` if agent has found a redirect rule for the current request uri;
- `null` if there isn't redirect rule set for the current uri in the agent.

### Log a request/response couple

[](#log-a-requestresponse-couple)

Allow you to log a request/response couple for every request.

```
use RedirectionIO\Client\Sdk\Client;
use RedirectionIO\Client\Sdk\Command\LogCommand;
use RedirectionIO\Client\Sdk\HttpMessage\Response;
use RedirectionIO\Client\Sdk\HttpMessage\Request;

$client->request(new LogCommand(Request $request, Response $response));
```

Parameters:

- `\RedirectionIO\Client\Sdk\HttpMessage\Response $request`
- `\RedirectionIO\Client\Sdk\HttpMessage\Request $response`

Return value:

- `bool` is `true` if log has been successfully added, else `false`

Contribution
------------

[](#contribution)

We take care of all new PRs. Any contribution is welcome :) Thanks.

### Install

[](#install)

```
$ composer install

```

### Run tests

[](#run-tests)

```
$ composer test

```

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community22

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~59 days

Recently: every ~72 days

Total

11

Last Release

2430d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c06557c871a39a7ff7f83bd03aa85dc381147cd7dcd83504400f0acd2fda7835?d=identicon)[lyrixx](/maintainers/lyrixx)

![](https://www.gravatar.com/avatar/16ce838e2759f19597de56865243a88711d822ba923c61e024090e87e4d3fc5f?d=identicon)[joelwurtz](/maintainers/joelwurtz)

![](https://www.gravatar.com/avatar/c6547f10fb51d1e84f1d5371fb44ee3593c7791432471f0b0adabfb29a18c507?d=identicon)[xavierlacot](/maintainers/xavierlacot)

![](https://avatars.githubusercontent.com/u/20137632?v=4)[Quentin Brunet](/maintainers/qboot)[@qboot](https://github.com/qboot)

---

Top Contributors

[![joelwurtz](https://avatars.githubusercontent.com/u/90466?v=4)](https://github.com/joelwurtz "joelwurtz (31 commits)")[![lyrixx](https://avatars.githubusercontent.com/u/408368?v=4)](https://github.com/lyrixx "lyrixx (23 commits)")[![qboot](https://avatars.githubusercontent.com/u/20137632?v=4)](https://github.com/qboot "qboot (20 commits)")[![xavierlacot](https://avatars.githubusercontent.com/u/177293?v=4)](https://github.com/xavierlacot "xavierlacot (2 commits)")

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/redirectionio-proxy-sdk/health.svg)

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

###  Alternatives

[symfony/lock

Creates and manages locks, a mechanism to provide exclusive access to a shared resource

514139.2M690](/packages/symfony-lock)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[ecotone/ecotone

Enterprise architecture layer for Laravel and Symfony — CQRS, Event Sourcing, Durable Workflows (Sagas, Orchestrators), Projections, and Outbox messaging via PHP attributes.

564576.7k52](/packages/ecotone-ecotone)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751291.4k43](/packages/civicrm-civicrm-core)[illuminate/broadcasting

The Illuminate Broadcasting package.

7127.2M208](/packages/illuminate-broadcasting)[logiscape/mcp-sdk-php

Model Context Protocol SDK for PHP

368116.8k12](/packages/logiscape-mcp-sdk-php)

PHPackages © 2026

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