Toxiproxy PHP Client - Toxiproxy makes it easy and trivial to test network conditions, for example low-bandwidth and high-latency situations

Last update: Jun 7, 2022

Toxiproxy PHP Client

Build status Coverage Status

Toxiproxy makes it easy and trivial to test network conditions, for example low-bandwidth and high-latency situations. toxiproxy-php-client includes everything needed to get started with configuring Toxiproxy upstream connection and listen endpoints.

Note: toxiproxy-php-client is currently compatible with toxiproxy-2.0+.

Installing via Composer

The recommended way to install toxiproxy-php-client is through Composer.

Once that is installed and you have added ihsw/toxiproxy-php-client to your composer.json configuration, you can require the autoloader and start using the library.

Here is an example for creating a proxy that limits a Redis connection to 1000KB/s.

create("ihsw_example_redis_master", "127.0.0.1:6379"); $toxic = $proxy->create(ToxicTypes::BANDWIDTH, StreamDirections::UPSTREAM, 1.0, [ "rate" => 1000 ]); printf( "Listening on IP %s and port %s on behalf of 6379, with a connection that's limited to 1000KB/s\n", $proxy->getListenIp(), $proxy->getListenPort() ); $toxiproxy->delete($proxy); ">


require("./vendor/autoload.php");

use Ihsw\Toxiproxy\Toxiproxy;
use Ihsw\Toxiproxy\ToxicTypes;
use Ihsw\Toxiproxy\StreamDirections;

$toxiproxy = new Toxiproxy("http://toxiproxy:8474");
$proxy = $toxiproxy->create("ihsw_example_redis_master", "127.0.0.1:6379");
$toxic = $proxy->create(ToxicTypes::BANDWIDTH, StreamDirections::UPSTREAM, 1.0, [
    "rate" => 1000
]);
printf(
    "Listening on IP %s and port %s on behalf of 6379, with a connection that's limited to 1000KB/s\n",
    $proxy->getListenIp(),
    $proxy->getListenPort()
);

$toxiproxy->delete($proxy);

Documentation

Additional examples can be found in the examples directory for expected usage.

GitHub

https://github.com/ihsw/toxiproxy-php-client
You might also like...

AltiriaSmsPhpClient, the official PHP client of Altiria

AltiriaSmsPhpClient, the official PHP client of Altiria

Altiria, cliente SMS PHP Altiria SMS PHP es un cliente que simplifica al máximo la integración de nuestro API para PHP. Por el momento, esta librería

Jan 3, 2022

PHP Client for the GoFlink API

GoFlink PHP API Client This project is an unofficial library to communicate with the GoFlink API from your PHP project. Documentation about the API is

Dec 30, 2021

A PHP client for the official Kizeo Forms API V3+. 📌

Kizeo Forms API V3+ - PHP This is a Swagger generated doc for Kizeo REST API 3. You can find additionnal documentation here : Online documentation. Th

Oct 26, 2021

Client for the Tenant Security Proxy in PHP

Tenant Security Client PHP Library A PHP client for implementing CMK within a vendor's infrastructure. Makes requests through an IronCore Tenant Secur

Nov 19, 2021

Shopee Open API v2 Client build with php

Shopee PHP Client This is a Shopee PHP Client, currently supported for API V2 in ShopeeOpenPlatform Composer Install composer require haistar/shopee-p

Jun 14, 2022

The official Previewify.app PHP Client

The official Previewify.app PHP Client

Previewify for PHP This is the official Previewify client for PHP. Support us Like our work? You can support us by purchasing one of our products. Ins

Jan 19, 2022

Production-ready, stable Kafka client for PHP

PHP Kafka client - php-rdkafka PHP-rdkafka is a stable, production-ready, long term support, and fast Kafka client for PHP based on librdkafka. It sup

Jul 2, 2022

VideoColor PHP Search Client

VideoColor PHP Search Client

This library is designed to find information about a movie and get the frame position using a screenshot from a video.

Mar 2, 2022

GitLab PHP API Client

GitLab PHP API Client

GitLab PHP API Client We present a modern GitLab API v4 client for PHP. This is strongly based on php-github-api by KnpLabs. With this in mind, we now

Jun 18, 2022
Comments
  • 1. Update to Guzzle 6 and PSR2

    This MR updates the client to use Guzzle 6 instead of Guzzle 5, which has very different semantics for HTTP requests and responses in order to conform to the PSR7 standard. This was necessary for our use case (and I imagine for others too), where we already depend on Guzzle 6 and aren't able/willing to downgrade just to get Toxiproxy working. All the existing unit tests still pass.

    I also took the opportunity here to integrate PHPCS and PHPCBF to make the coding style compliant with PSR2. This constitutes the majority of the changes in this MR but they're all functionally no-ops. I'd recommend looking at the first commit only for the diff.

    If/when this is merged, would it be possible to cut a 1.1.0 or 2.0.0 release?

    Reviewed by tylerchr at 2017-12-21 00:48
  • 2. Question about latency.php

    Hi sir, thx for your repository, I'm not sure if I express myself well on the subject due to my imperfect English.

    Question about your latency script, the latency time is does the latency apply in both directions ?

    When a request is sent, latency, when a request is received, latency ?

    if so, that's perfect. if this is not the case is it possible to choose a different latency for the reception and the sending ?

    client -> proxy -> latency 100 -> server.

    server - lacency 1000 -> proxy -> client.

    Thank you for your explanations.

    Reviewed by sktechnology at 2022-06-27 17:32
PHP JSON-RPC 2.0 Server/Client Implementation with Automatic Client Class Generation via SMD

PHP JSON-RPC 2.0 Server/Client Implementation with Automatic Client Class Generation via SMD

Feb 14, 2022
⚡️ Web3 PHP is a supercharged PHP API client that allows you to interact with a generic Ethereum RPC.
⚡️ Web3 PHP is a supercharged PHP API client that allows you to interact with a generic Ethereum RPC.

Web3 PHP is a supercharged PHP API client that allows you to interact with a generic Ethereum RPC. This project is a work-in-progress. Code and docume

Jun 26, 2022
A simple PHP GitHub API client, Object Oriented, tested and documented.

PHP GitHub API A simple Object Oriented wrapper for GitHub API, written with PHP. Uses GitHub API v3 & supports GitHub API v4. The object API (v3) is

Jun 25, 2022
Nexmo REST API client for PHP. API support for SMS, Voice, Text-to-Speech, Numbers, Verify (2FA) and more.

Client Library for PHP Support Notice This library and it's associated packages, nexmo/client and nexmo/client-core have transitioned into a "Maintena

May 27, 2022
A simple Object Oriented PHP Client for Termii SMS API

Termii Client A simple Object Oriented PHP Client for Termii SMS API. Uses Termii API. Requirements PHP >= 7.2 Guzzlehttp ~6|~7 Installation Via Compo

Feb 24, 2022
Xendit REST API Client for PHP - Card, Virtual Account, Invoice, Disbursement, Recurring Payments, Payout, EWallet, Balance, Retail Outlets Services

Xendit REST API Client for PHP - Card, Virtual Account, Invoice, Disbursement, Recurring Payments, Payout, EWallet, Balance, Retail Outlets Services

Jun 29, 2022
PHP client for Kafka

A library to allow people to communicate to Kafka using plain PHP, compatible with Kafka v0.11+ (due to the way the protocol works).

May 21, 2022
php 8 client for the lemon.markets api

lemon.markets php client This repository contains a php 8+ compatible client for the https://lemon.markets API. The documentation of the API can be fo

Dec 21, 2021
PHP client for Microsoft Azure Face API.

Microsoft Azure Face API PHP client A PHP library that utilizes Azure Face REST API. Requirements PHP >= 7.4 Installation composer require darmen/php-

May 20, 2022
Google PHP API Client Services

Google PHP API Client Services

Jun 30, 2022