Download the PHP package redirectionio/proxy-sdk without Composer
On this page you can find all versions of the php package redirectionio/proxy-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download redirectionio/proxy-sdk
More information about redirectionio/proxy-sdk
Files in redirectionio/proxy-sdk
Package proxy-sdk
Short Description PHP common code for redirection.io proxy
License MIT
Informations about the package proxy-sdk
redirection.io 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, but only with the legacy 1.x branch. We advise you to migrate and use one of the recommended integrations.
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):
Requirements
- Composer
- PHP 5.5+
Installation
To use redirection.io in your project, add it to your composer.json file:
$ composer require redirectionio/proxy-sdk
Usage
Instantiate Client
Before starting, you need to instantiate a new Client.
Parameters:
-
$projectKey
your project key (can be found in redirection.io dashboard) -
$connections
array of connection(s) parameters to the Agent(s) $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
Check if request URI matches a redirect rule in the agent. If yes return a
RedirectResponse
, else return null
.
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 (<1.4.0)
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.
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
Allow you to log a request/response couple for every request.
Parameters:
\RedirectionIO\Client\Sdk\HttpMessage\Response $request
\RedirectionIO\Client\Sdk\HttpMessage\Request $response
Return value:
bool
istrue
if log has been successfully added, elsefalse
Contribution
We take care of all new PRs. Any contribution is welcome :) Thanks.
Install
$ composer install
Run tests
$ composer test