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

Overview

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.

You might also like...
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

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).

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

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-

Google PHP API Client Services

Google PHP API Client Services

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

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

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

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

Comments
  • Update to Guzzle 6 and PSR2

    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?

    opened by tylerchr 2
  • Question about latency.php

    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.

    opened by sktechnology 1
Releases(v1.0.5)
Owner
Adrian Parker
Full Stack Developer specializing in Secure Hosted IT as a Service (SHITaaS)
Adrian Parker
Google-api-php-client - A PHP client library for accessing Google APIs

Google APIs Client Library for PHP Reference Docs https://googleapis.github.io/google-api-php-client/main/ License Apache 2.0 The Google API Client Li

Google APIs 8.4k Dec 30, 2022
OpenAI API Client is a component-oriented, extensible client library for the OpenAI API. It's designed to be faster and more memory efficient than traditional PHP libraries.

OpenAI API Client in PHP (community-maintained) This library is a component-oriented, extensible client library for the OpenAI API. It's designed to b

Mounir R'Quiba 6 Jun 14, 2023
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

Sergey Bykov 63 Feb 14, 2022
The Smart-ID PHP client can be used for easy integration of the Smart-ID solution to information systems or e-services

Smart-ID PHP client Introduction The Smart-ID PHP client can be used for easy integration of the Smart-ID solution to information systems or e-service

SK ID Solutions 16 Oct 23, 2022
High performance Clickhouse PHP lib with progress tracking, parametric queries and compression support

Clickhousy High performance Clickhouse PHP library featuring: Tiny memory footprint based on static class (times better than smi2 client) High level m

Denys Golotiuk (hacking) 5 Dec 24, 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. This project is a work-in-progress. Code and docume

Web3 PHP 665 Dec 23, 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

KNP Labs 2k Jan 7, 2023
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

Nexmo 75 Sep 23, 2022
Attempting to create an intelligent mock of the Google API PHP Client for unit and functional testing

google-api-php-client-mock A small scale intelligent mock of the Google API PHP Client for unit and functional testing. Overview This is intended to m

SIL International 0 Jan 4, 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

Ilesanmi Olawale Adedotun 5 Feb 24, 2022