PHPackages                             utopia-php/balancer - 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. [Framework](/categories/framework)
4. /
5. utopia-php/balancer

ActiveLibrary[Framework](/categories/framework)

utopia-php/balancer
===================

A simple library to balance choices between multiple options.

0.4.0(2y ago)6894MITPHPPHP &gt;=8.0

Since Oct 27Pushed 1y ago6 watchersCompare

[ Source](https://github.com/utopia-php/balancer)[ Packagist](https://packagist.org/packages/utopia-php/balancer)[ RSS](/packages/utopia-php-balancer/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (3)Versions (15)Used By (0)

Utopia Balancer
===============

[](#utopia-balancer)

[![Build Status](https://github.com/utopia-php/balancer/actions/workflows/tester.yml/badge.svg)](https://github.com/utopia-php/balancer/actions/workflows/tester.yml)[![Total Downloads](https://camo.githubusercontent.com/cf199400f548f244263a5d4409977af79c26f9fcfd7328f44288044490265b95/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f75746f7069612d7068702f64617461626173652e737667)](https://packagist.org/packages/utopia-php/balancer)[![Discord](https://camo.githubusercontent.com/6e418910df1b6eb524c6cbd88dbaf5a5aa294316eeadcd963e11262a319f6321/68747470733a2f2f696d672e736869656c64732e696f2f646973636f72642f3536343136303733303834353135313234343f6c6162656c3d646973636f7264)](https://appwrite.io/discord)

Utopia Balancer library is simple and lite library for balancing choices between multiple options. This library is aiming to be as simple and easy to learn and use. This library is maintained by the [Appwrite team](https://appwrite.io).

Although this library is part of the [Utopia Framework](https://github.com/utopia-php/framework) project it is dependency free and can be used as standalone with any other PHP project or framework.

Getting Started
---------------

[](#getting-started)

Install using composer:

```
composer require utopia-php/balancer
```

Balancer supports multiple algorithms. Each picks option differently, and may have different set of methods available for configuration.

### Balancer Algorithms

[](#balancer-algorithms)

1. Random

`Random` algorithm pick option randomly. The same option could be picked multiple times in a row. Example:

```
