PHPackages                             code4mk/lara-rating - 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. code4mk/lara-rating

ActiveLibrary

code4mk/lara-rating
===================

7272PHP

Since May 11Pushed 7y ago1 watchersCompare

[ Source](https://github.com/code4mk/lara-rating)[ Packagist](https://packagist.org/packages/code4mk/lara-rating)[ RSS](/packages/code4mk-lara-rating/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

[![](https://user-images.githubusercontent.com/17185462/57544423-1ad64d80-7379-11e9-8191-3916f389032e.png)](https://user-images.githubusercontent.com/17185462/57544423-1ad64d80-7379-11e9-8191-3916f389032e.png)

Rating system Laravel
=====================

[](#rating-system-laravel)

Easily setup rating system in your laravel poject

installation
============

[](#installation)

```
composer require code4mk/lara-rating
```

setup
=====

[](#setup)

1) vendor publish
-----------------

[](#1-vendor-publish)

```
php artisan vendor:publish --provider="Code4mk\LaraRate\LaraRateServiceProvider" --tag=config
php artisan vendor:publish --provider="Code4mk\LaraRate\LaraRateServiceProvider" --tag=migrations
```

2) config
---------

[](#2-config)

- `config/laraRate.php`

```
"rater_table_name" => "users",
"rater_retrive_columns" =>["id","email"]
```

- `php artisan config:clear`

method
======

[](#method)

`create()`
----------

[](#create)

- `int $productID, int $raterID, int $rate, string $comment`

```
use Krate;
Krate::create($productID,$userID,$rate,$comment)
```

`update()`
----------

[](#update)

- `int $productID, int $raterID, int $rate, string $comment`

```
use Krate;
Krate::update($productID,$raterID,$rate,$comment);
```

`getRatings()`
--------------

[](#getratings)

- get specific product's rating details
- `int productID`

```
Krate::getRatings($productID);
```

- output

~ `Krate::getRatings(3)`

```
[
  {
    "id": 1,
    "product_id": 3,
    "rater_id": 3,
    "rating": 5,
    "comment": "5star",
    "created_at": "2019-05-10 16:25:10",
    "updated_at": "2019-05-10 16:25:10",
    "rater": {
      "id": 3,
      "email": "maruf@gmail.com"
    }
  },
  {
    "id": 2,
    "product_id": 3,
    "rater_id": 2,
    "rating": 2,
    "comment": "2star",
    "created_at": "2019-05-10 16:26:58",
    "updated_at": "2019-05-10 16:26:58",
    "rater": {
      "id": 2,
      "email": "jamal@gmail.com"
    }
  }
]
```

`getRatingStat()`
-----------------

[](#getratingstat)

- rating type
- `int productID`

```
Krate::getRatingStat($productID);
```

- output

~ `Krate::getRatingStat(3)`

```
{
    "rateType": {
        "one_star": {
            "star": 0,
            "percent": 0
        },
        "two_star": {
            "star": 1,
            "percent": 50
        },
        "three_star": {
            "star": 0,
            "percent": 0
        },
        "four_star": {
            "star": 0,
            "percent": 0
        },
        "five_star": {
            "star": 1,
            "percent": 50
        }
    },
    "total_rater": 2,
    "rating": 4
}
```

getRaterRatings
---------------

[](#getraterratings)

- customer/rater/user's rating lists
- `int raterID`

```
Krate::getRaterRatings($raterID);
```

~ `Krate::getRaterRatings(2)`

```
[
    {
        "id": 1,
        "product_id": 1,
        "rater_id": 1,
        "rating": 5,
        "comment": "5 star",
        "created_at": "2019-05-11 00:55:46",
        "updated_at": "2019-05-11 00:55:46",
        "product": {
            "name": "iphone 10",
            "slug": "iphone-10"
        }
    }
]
```

[](https://twitter.com/0devco)

[![](https://raw.githubusercontent.com/0devco/docs/master/.devco-images/logo-transparent.png)](https://raw.githubusercontent.com/0devco/docs/master/.devco-images/logo-transparent.png)

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/5e3bffe09346f036f5a42f64d3b771b9bf41a44ffd712caecac932f69f990ed7?d=identicon)[code4mk](/maintainers/code4mk)

---

Tags

0devcocode4mklaravelrating-system

### Embed Badge

![Health badge](/badges/code4mk-lara-rating/health.svg)

```
[![Health](https://phpackages.com/badges/code4mk-lara-rating/health.svg)](https://phpackages.com/packages/code4mk-lara-rating)
```

PHPackages © 2026

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