PHPackages                             ilicmiljan/weighted-ratings - 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. ilicmiljan/weighted-ratings

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

ilicmiljan/weighted-ratings
===========================

A lightweight PHP library for calculating the Wilson Lower Bound Score and Bayesian Approximation weights for sorting algorithms based on user feedback.

v1.1.0(3y ago)352.9k↑10.2%MITPHPPHP &gt;=7.4

Since Jun 5Pushed 3y ago1 watchersCompare

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

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

Weighted Ratings
================

[](#weighted-ratings)

A lightweight PHP library for calculating the **Wilson Lower Bound Score** and **Bayesian Approximation** weights for sorting algorithms based on user feedback.

Installation
============

[](#installation)

**Weighted Ratings** Library is available via Composer. Just add this line to your `composer.json` file:

```
"ilicmiljan/weighted-ratings": "^1.0"

```

or you can run:

```
composer require ilicmiljan/weighted-ratings

```

Note that the `vendor` folder and the `vendor/autoload.php` script are generated by Composer and they are not part of Weighted Ratings Library.

Configuration
=============

[](#configuration)

### Available Formulas

[](#available-formulas)

```
RatingWeightCalculator::FORMULA_WILSON_LOWER_BOUND
RatingWeightCalculator::FORMULA_BAYESIAN_APPROXIMATION
```

### Optional Configuration Parameters

[](#optional-configuration-parameters)

- `ausmeNegativeRatingisLessThan` - Number of stars in the rating that are assumed as negative (*Default: 3*)
- `confidence` - Statistical Confidence used in Formulas (*Default: 0.95*)

### Without `RatingWeightConfig`

[](#without-ratingweightconfig)

You can use default optional config parameters to calculate weights without instantiating `RateLimiterConfig`. This can be achieved by setting the `formula` in the instance of `RatingWeightCalculator`.

### Using `RatingWeightConfig`

[](#using-ratingweightconfig)

You can create a new instance of `RatingWeightConfig` with all the parameters and pass it to the `RatingWeightCalculator`.

### Changing Formula

[](#changing-formula)

The formula for one instance of `RatingWeightCalculator` can be set only once. Changing formula in the runtime will throw an exception.

Usage
=====

[](#usage)

### With Default Config Parameters

[](#with-default-config-parameters)

```
$weightCalculator = new RatingWeightCalculator();

$ratingWeight = $weightCalculator->formula(RatingWeightCalculator::FORMULA_WILSON_LOWER_BOUND)
    ->calculateWeight([2,4,6,12,24]);
```

### With Custom Parameters

[](#with-custom-parameters)

```
$weightCalculator = new RatingWeightCalculator(
    new RatingWeightConfig(RatingWeightCalculator::FORMULA_WILSON_LOWER_BOUND, 5, 0.9)
);

$ratingWeight = $weightCalculator->calculateWeight([2,4,6,12,24,48,92,184,]);
```

Testing
=======

[](#testing)

To run Unit Tests inside this library you can use this command:

```
./vendor/bin/phpunit

```

### Infection PHP Metrics:

[](#infection-php-metrics)

- Mutation Score Indicator (MSI): **98%**
- Mutation Code Coverage: **100%**
- Covered Code MSI: **98%**

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

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 ~70 days

Total

3

Last Release

1304d ago

### Community

Maintainers

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

---

Top Contributors

[![ilicmiljan](https://avatars.githubusercontent.com/u/14331591?v=4)](https://github.com/ilicmiljan "ilicmiljan (73 commits)")

---

Tags

reviewweightRatingweighted-ratingssorting-weightsreviews-sorting

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/ilicmiljan-weighted-ratings/health.svg)

```
[![Health](https://phpackages.com/badges/ilicmiljan-weighted-ratings/health.svg)](https://phpackages.com/packages/ilicmiljan-weighted-ratings)
```

###  Alternatives

[kartik-v/bootstrap-star-rating

A simple yet powerful JQuery star rating plugin for Bootstrap.

1.1k4.5M5](/packages/kartik-v-bootstrap-star-rating)[willvincent/laravel-rateable

Allows multiple models to be rated with a fivestar like system.

416452.0k3](/packages/willvincent-laravel-rateable)[codebyray/laravel-review-rateable

Review &amp; Rating system for Laravel 10, 11 &amp; 12

310351.9k](/packages/codebyray-laravel-review-rateable)[kartik-v/yii2-widget-rating

A Yii2 widget for the simple yet powerful bootstrap-star-rating plugin with fractional rating support (sub repo split from yii2-widgets)

444.1M8](/packages/kartik-v-yii2-widget-rating)[ghanem/rating

Rating system for Laravel

8615.5k](/packages/ghanem-rating)[cartalyst/converter

A framework agnostic measurement conversion and formatting package featuring multiple types of measurements and currency conversion.

88434.4k7](/packages/cartalyst-converter)

PHPackages © 2026

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