PHPackages                             balsama/benford - 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. balsama/benford

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

balsama/benford
===============

A Benford's law distribution and deviation calculator.

1.0.0-alpha1(6y ago)231GPL-2.0-or-laterPHPCI failing

Since Mar 29Pushed 5y ago1 watchersCompare

[ Source](https://github.com/balsama/benford)[ Packagist](https://packagist.org/packages/balsama/benford)[ RSS](/packages/balsama-benford/feed)WikiDiscussions master Synced 4d ago

READMEChangelogDependenciesVersions (2)Used By (0)

Benford Calculator
==================

[](#benford-calculator)

Benford's Law states that, in many naturally occurring collections of numbers, the leading significant digit is likely to be small. Specifically, the number 1 appears as the leading significant digit about 30% of the time, while 9 appears as the leading significant digit less than 5% of the time. The same percentages can be extrapolated out to the second and third digits. (After the third digit, all numbers have about the same likelihood of appearing.)

[Benford's law](https://en.wikipedia.org/wiki/Benford%27s_law)

Usage
-----

[](#usage)

Include in your project:

```
$ composer require balsama/benford

```

Calculating the percentage that digits \[0-9\] appear in the first three places of a set of numbers.

```
$set = [123, 1, 707, 2];
$distibution = Balsama\Benford::getBenfordDistrubution($set);
print_r($distibution);
//  [
//      [1] => [0, 50, 25, 0, 0, 0, 0, 25, 0, 0],
//      [2] => [50, 0, 50, 0, 0, 0, 0, 0, 0, 0],
//      [3] => [0, 0, 0, 50, 0, 0, 0, 50, 0, 0],
//  ]
```

Calculating the deviation from the Benford prediction.

```
$set = [...]; // A large set of numbers spanning multiple orders of magnitude for best results.
$deviation = Balsama\Benford::getBenfordDeviationScoreFromSet($set);
print $deviation;
// A float. 20 is a good number (meaning likely to be a naturally occurring number set. Use your own data sets to
// determine what a good or bad score is for your purposes.
```

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

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

2239d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f6073b94ae2519d22681a73ae734eff3d679543ea15bcae3a2d4dbcb271ca9ac?d=identicon)[balsama](/maintainers/balsama)

---

Top Contributors

[![balsama](https://avatars.githubusercontent.com/u/1536654?v=4)](https://github.com/balsama "balsama (1 commits)")[![CMiksche](https://avatars.githubusercontent.com/u/9869391?v=4)](https://github.com/CMiksche "CMiksche (1 commits)")

### Embed Badge

![Health badge](/badges/balsama-benford/health.svg)

```
[![Health](https://phpackages.com/badges/balsama-benford/health.svg)](https://phpackages.com/packages/balsama-benford)
```

###  Alternatives

[reefki/laravel-device-detector

Laravel wrapper for Matomo's Universal Device Detection library.

2852.6k](/packages/reefki-laravel-device-detector)

PHPackages © 2026

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