ilicmiljan/weighted-ratings
Composer 安装命令:
composer require 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.
README 文档
README
A lightweight PHP library for calculating the Wilson Lower Bound Score and Bayesian Approximation weights for sorting algorithms based on user feedback.
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
Available Formulas
RatingWeightCalculator::FORMULA_WILSON_LOWER_BOUND RatingWeightCalculator::FORMULA_BAYESIAN_APPROXIMATION
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
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
You can create a new instance of RatingWeightConfig with all the parameters and pass it to the RatingWeightCalculator.
Changing Formula
The formula for one instance of RatingWeightCalculator can be set only once. Changing formula in the runtime will throw an exception.
Usage
With Default Config Parameters
$weightCalculator = new RatingWeightCalculator(); $ratingWeight = $weightCalculator->formula(RatingWeightCalculator::FORMULA_WILSON_LOWER_BOUND) ->calculateWeight([2,4,6,12,24]);
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
To run Unit Tests inside this library you can use this command:
./vendor/bin/phpunit
Infection PHP Metrics:
- Mutation Score Indicator (MSI): 98%
- Mutation Code Coverage: 100%
- Covered Code MSI: 98%
ilicmiljan/weighted-ratings 适用场景与选型建议
ilicmiljan/weighted-ratings 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 60.08k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2022 年 06 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「review」 「Rating」 「weight」 「weighted-ratings」 「sorting-weights」 「reviews-sorting」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ilicmiljan/weighted-ratings 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ilicmiljan/weighted-ratings 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ilicmiljan/weighted-ratings 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Review system for Symfony ecommerce applications.
This Extension integrates a credit check and more made by the LEONEX Risk Management Platform into your order process. Extensive configuration and evaluation options is provided in the Platform
A PHP library for accessing the Trustpilot Invitation API and fetching recieved Product reviews
The universal PHP library to convert any values and measures
AvoRed Laravel E commerce - Product Review Module
Rating syetem for Laravel 5
统计信息
- 总下载量: 60.08k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 26
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-06-05