PHPackages                             jpuck/peer-value-distributer - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. jpuck/peer-value-distributer

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

jpuck/peer-value-distributer
============================

Given an array, return a new array with the same keys and values randomly distributed evenly amongst the peers in the specified batch quantity.

1.0.1(9y ago)019GPL-3.0+PHPPHP ^7.0

Since Jan 24Pushed 8y ago1 watchersCompare

[ Source](https://github.com/jpuck/peer-value-distributer)[ Packagist](https://packagist.org/packages/jpuck/peer-value-distributer)[ RSS](/packages/jpuck-peer-value-distributer/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (1)Versions (3)Used By (0)

Peer Value Distributer
======================

[](#peer-value-distributer)

Given an array, return a new array with the same keys and values distributed randomly and evenly amongst the peers in the specified batch quantity.

[![Build Status](https://camo.githubusercontent.com/7bc1d880d2a7f17e7e5d2463b330e559de6b31839d50d25534d8b1b173477516/68747470733a2f2f7472617669732d63692e6f72672f6a7075636b2f706565722d76616c75652d64697374726962757465722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/jpuck/peer-value-distributer) [![Codecov](https://camo.githubusercontent.com/641d987a26e5c4a58953f6351bdc776730d97b0f2070c719735cb7e925d9df95/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6a7075636b2f706565722d76616c75652d64697374726962757465722f6d61737465722e737667)](https://codecov.io/gh/jpuck/peer-value-distributer/branch/master)

For example, say you have a group of 15 book authors. You want each author to review 3 of their peers' work. This function will randomly assign each author 3 of its peers to read.

- Every book is reviewed exactly 3 times.
- No one will review any book more than once.
- No one will review their own book.

The natural maximum distribution count is `n-1`so if you specify a count larger than that, it will be ignored and the largest possible count will be used instead.

e.g. if you distribute those 15 books with a count of 20, it will be ignored and instead every author will be assigned the maximum of 14 peer books to review.

Registered on [packagist](https://packagist.org/packages/jpuck/peer-value-distributer) for easy installation using [composer](https://getcomposer.org/).

```
composer require jpuck/peer-value-distributer

```

Example
-------

[](#example)

```
use jpuck\PeerValueDistributer;

$books = [
    'John' => 'The Book of John',
    'Jane' => 'A Work by Jane',
    'Jeff' => 'Readings from Jeff',
    'Jose' => 'Words of Jose',
    'Jena' => 'Writing with Jena',
];

print_r( PeerValueDistributer::distribute($books, $count = 3) );
```

Output:

> ```
> Array
> (
>     [Jena] => Array
>         (
>             [John] => The Book of John
>             [Jeff] => Readings from Jeff
>             [Jane] => A Work by Jane
>         )
>
>     [John] => Array
>         (
>             [Jeff] => Readings from Jeff
>             [Jane] => A Work by Jane
>             [Jose] => Words of Jose
>         )
>
>     [Jeff] => Array
>         (
>             [Jane] => A Work by Jane
>             [Jose] => Words of Jose
>             [Jena] => Writing with Jena
>         )
>
>     [Jane] => Array
>         (
>             [Jose] => Words of Jose
>             [Jena] => Writing with Jena
>             [John] => The Book of John
>         )
>
>     [Jose] => Array
>         (
>             [Jena] => Writing with Jena
>             [John] => The Book of John
>             [Jeff] => Readings from Jeff
>         )
>
> )
>
> ```

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

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

Every ~4 days

Total

2

Last Release

3439d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4d3f43ad248cd9c696b067b19e4e18856d78a8b2e4f2c3ee21a1d3d5cead5610?d=identicon)[jpuck](/maintainers/jpuck)

---

Top Contributors

[![jpuck](https://avatars.githubusercontent.com/u/15305396?v=4)](https://github.com/jpuck "jpuck (9 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jpuck-peer-value-distributer/health.svg)

```
[![Health](https://phpackages.com/badges/jpuck-peer-value-distributer/health.svg)](https://phpackages.com/packages/jpuck-peer-value-distributer)
```

###  Alternatives

[vipx/bot-detect

Bot detector library

45345.3k1](/packages/vipx-bot-detect)

PHPackages © 2026

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