PHPackages                             php-http/random-host-plugin - 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. php-http/random-host-plugin

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

php-http/random-host-plugin
===========================

Client-side round robin load balancer plugin for HTTPlug

1.0.0(4y ago)13.0kMITPHPPHP &gt;=7.4

Since Feb 23Pushed 4y ago4 watchersCompare

[ Source](https://github.com/php-http/random-host-plugin)[ Packagist](https://packagist.org/packages/php-http/random-host-plugin)[ Docs](https://github.com/php-http/random-host-plugin)[ RSS](/packages/php-http-random-host-plugin/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (7)Versions (2)Used By (0)

Random Host Plugin
==================

[](#random-host-plugin)

You might have found yourself in strange situation where instead of people using load balancer, they supply you list of hosts you should try to call. They also don't like it when you pick one of them and use that, instead of going through trouble of doing distribution on client side.

If you want to go through this trouble, you can use this HTTPlug plugin. It picks one of the hosts randomly at beginning and then keeps using it (sticky session), until there is a server or network error - in that case host that's being used is swapped for something else from the list. This ensures same host is never used twice in a row in case you use some retry mechanism.

Install
-------

[](#install)

Via [Composer](https://getcomposer.org/doc/00-intro.md)

```
composer require php-http/random-host-plugin
```

Usage
-----

[](#usage)

```
new \Http\Client\Common\Plugin\SetRandomHostPlugin(
    $psr17Factory,
    ['hosts' => ['https://host1.example','https://host2.example']],
);
```

Licensing
---------

[](#licensing)

MIT license. Please see [License File](LICENSE) for more information.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 93.3% 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

Unknown

Total

1

Last Release

1546d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/76576?v=4)[David Buchmann](/maintainers/dbu)[@dbu](https://github.com/dbu)

![](https://www.gravatar.com/avatar/2f56471f595636876f95264fa5c455d611329a4820193f88d22e83a5bd900292?d=identicon)[ostrolucky](/maintainers/ostrolucky)

---

Top Contributors

[![ostrolucky](https://avatars.githubusercontent.com/u/496233?v=4)](https://github.com/ostrolucky "ostrolucky (14 commits)")[![dbu](https://avatars.githubusercontent.com/u/76576?v=4)](https://github.com/dbu "dbu (1 commits)")

---

Tags

httppluginhttplug

### Embed Badge

![Health badge](/badges/php-http-random-host-plugin/health.svg)

```
[![Health](https://phpackages.com/badges/php-http-random-host-plugin/health.svg)](https://phpackages.com/packages/php-http-random-host-plugin)
```

###  Alternatives

[php-http/cache-plugin

PSR-6 Cache plugin for HTTPlug

25024.2M71](/packages/php-http-cache-plugin)[php-http/client-common

Common HTTP Client implementations and tools for HTTPlug

1.1k225.5M571](/packages/php-http-client-common)[php-http/logger-plugin

PSR-3 Logger plugin for HTTPlug

29025.3M69](/packages/php-http-logger-plugin)[php-http/stopwatch-plugin

Symfony Stopwatch plugin for HTTPlug

26721.1M3](/packages/php-http-stopwatch-plugin)[php-http/httplug-bundle

Symfony integration for HTTPlug

38921.0M54](/packages/php-http-httplug-bundle)[friendsofsymfony/http-cache

Tools to manage HTTP caching proxies with PHP

36114.7M36](/packages/friendsofsymfony-http-cache)

PHPackages © 2026

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