PHPackages                             dutta/laravel-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. dutta/laravel-rating

ActiveLibrary

dutta/laravel-rating
====================

manage rating column for elqouent models

1.0.2(3y ago)123MITPHPPHP ^8.0|^7.3

Since Jul 30Pushed 3y ago1 watchersCompare

[ Source](https://github.com/dutta07/laravel-rating)[ Packagist](https://packagist.org/packages/dutta/laravel-rating)[ Docs](https://github.com/dutta/laravel-rating)[ RSS](/packages/dutta-laravel-rating/feed)WikiDiscussions master Synced 1mo ago

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

 [![](https://camo.githubusercontent.com/583681c31301a5e17e0860d1375bbbefc406f2a44543e4e329f389d2b9ae560d/68747470733a2f2f696d6167652e6962622e636f2f65474b5067772f69665f3031395f537461725f323739323934372e706e67)](https://camo.githubusercontent.com/583681c31301a5e17e0860d1375bbbefc406f2a44543e4e329f389d2b9ae560d/68747470733a2f2f696d6167652e6962622e636f2f65474b5067772f69665f3031395f537461725f323739323934372e706e67) [![](./media/like-dislike.png)](./media/like-dislike.png) [![](https://camo.githubusercontent.com/c622d7b2c4e679f027bea8b5132fb21e08c19a18784c81daff91dd61ef1b16b8/68747470733a2f2f696d6167652e6962622e636f2f6867636f38622f69665f63686576726f6e5f75705f3137333138302e706e67)](https://camo.githubusercontent.com/c622d7b2c4e679f027bea8b5132fb21e08c19a18784c81daff91dd61ef1b16b8/68747470733a2f2f696d6167652e6962622e636f2f6867636f38622f69665f63686576726f6e5f75705f3137333138302e706e67) [![](https://camo.githubusercontent.com/0151589f2027f2afb2075f319a8775937bef788db272fdf16b15045baa95848f/68747470733a2f2f696d6167652e6962622e636f2f62414e7a45472f69665f63686576726f6e5f646f776e5f3137333137372e706e67)](https://camo.githubusercontent.com/0151589f2027f2afb2075f319a8775937bef788db272fdf16b15045baa95848f/68747470733a2f2f696d6167652e6962622e636f2f62414e7a45472f69665f63686576726f6e5f646f776e5f3137333137372e706e67)

New Maintainer
==============

[](#new-maintainer)

This package now maintined by [Dutta Fachrezy](https://www.instagram.com/duttaf_7/)

Laravel-Ratings
===============

[](#laravel-ratings)

Laravel package that allows you to **rate, like &amp; dislike or vote up &amp; down** your models with a simple and clear way.
*If you see this packge can help, Don't skimp on me with a star :)*

- [Install](https://github.com/dutta07/Laravel-rating#install)
- [![](https://camo.githubusercontent.com/583681c31301a5e17e0860d1375bbbefc406f2a44543e4e329f389d2b9ae560d/68747470733a2f2f696d6167652e6962622e636f2f65474b5067772f69665f3031395f537461725f323739323934372e706e67)](https://camo.githubusercontent.com/583681c31301a5e17e0860d1375bbbefc406f2a44543e4e329f389d2b9ae560d/68747470733a2f2f696d6167652e6962622e636f2f65474b5067772f69665f3031395f537461725f323739323934372e706e67) [Rating](https://github.com/dutta07/Laravel-rating#rating)
- [![](./media/like-dislike.png)](./media/like-dislike.png) [Like &amp; Dislike](https://github.com/mohamednagy/Laravel-rating#like--dislike)
- [![](https://camo.githubusercontent.com/c622d7b2c4e679f027bea8b5132fb21e08c19a18784c81daff91dd61ef1b16b8/68747470733a2f2f696d6167652e6962622e636f2f6867636f38622f69665f63686576726f6e5f75705f3137333138302e706e67)](https://camo.githubusercontent.com/c622d7b2c4e679f027bea8b5132fb21e08c19a18784c81daff91dd61ef1b16b8/68747470733a2f2f696d6167652e6962622e636f2f6867636f38622f69665f63686576726f6e5f75705f3137333138302e706e67) [Voting](https://github.com/dutta07/Laravel-rating#voting)

Rating
------

[](#rating)

include `CanRate` trait into your user model to apply rating functions

```
use Dutta\LaravelRating\Traits\Rate\CanRate;

class User extends Model
{
    use CanRate;
```

include `Rateable` trait to your model that will be rateable

```
use Dutta\LaravelRating\Traits\Rate\Rateable;

class Post extends Model
{
    use Rateable;
```

now you can rate your models as the following:

```
$user->rate($postModel, 5);
```

also you can unrate your models as the following:

```
$user->unrate($postModel);

// alternatively
$user->rate($postModel, -1);
// or
$user->rate($postModel, false);
// or
$user->rate($postModel, null);
```

get the average ratings of a model

```
$post->ratingsAvg();
```

get the total count of ratings of a model

```
$post->ratingsCount();
```

get the rated models by a user

```
$user->rated(); // returns a collection of rated models
```

Voting
------

[](#voting)

include `CanVote` trait into your user model to apply rating functionalties

```
use Dutta\LaravelRating\Traits\Vote\CanVote;

class User extends Model
{
    use CanVote;
```

include `Votable` trait to your model that will be votable

```
use Dutta\LaravelRating\Traits\Vote\Votable;

class Post extends Model
{
    use Votable;
```

now you can vote your model as the following:

```
// up vote or +1  your model
$user->upVote($postModel);

// down vote or -1 your model
$user->downVote($postModel);
```

get total votes count

```
$postModel->votesCount();
```

get total up votes count

```
$postModel->upVotesCount();
```

get total down votes count

```
$postModel->downVotesCount();
```

get the up voted models by a user

```
$user->upVoted(); // returns a collection of up voted models
```

get the down voted models by a user

```
$user->downVoted(); // returns a collection of down voted models
```

get the total voted models by a user

```
$user->voted(); // returns a collection of total voted models;
```

Like &amp; Dislike
------------------

[](#like--dislike)

include `CanLike` trait into your user model to apply like and dislike functionalties

```
use Dutta\LaravelRating\Traits\Like\CanLike;

class User extends Model
{
    use CanLike;
```

include `Likeable` trait to your model that will be likeable

```
use Dutta\LaravelRating\Traits\Like\Likeable;

class Post extends Model
{
    use Likeable;
```

now you can like your model as the following:

```
// like
$user->like($postModel);

// dislike
$user->dislike($postModel);
```

get total likes count

```
$postModel->likesCount();
```

get total dislikes count

```
$postModel->dislikesCount();
```

get total likes and dislikes count

```
$postModel->likesDislikesCount();
```

get the liked models by a user

```
$user->liked(); // return a collection of liked models;
```

get the disliked models by a user

```
$user->disliked(); // return a collection of disliked models;
```

get the total liked and disliked models by a user

```
$user->likedDisliked(); // return a collection of liked and disliked models;
```

Install
=======

[](#install)

for laravel 8.\* , 7.\* , 6.\*

```
composer require dutta/laravel-rating
```

in your config/app.php

```
    'providers' => [
        ...
        Dutta\LaravelRating\LaravelRatingServiceProvider::class
    ],

    'aliases' => [
        ...
        "LaravelRating" => \Dutta\LaravelRating\LaravelRatingFacade::class,
    ]
```

> You don't need this step in laravel5.5 `package:discover` will do the job :)

publish the migrations

```
php artisan vendor:publish --tag=laravelRatings
```

run the migrations

```
php artisan migrate
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

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

Total

2

Last Release

1364d ago

### Community

Maintainers

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

---

Top Contributors

[![bionyxxx](https://avatars.githubusercontent.com/u/60208449?v=4)](https://github.com/bionyxxx "bionyxxx (6 commits)")

---

Tags

configgithub-configlaravel-rating

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/dutta-laravel-rating/health.svg)

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

###  Alternatives

[illuminate/console

The Illuminate Console package.

12944.1M5.1k](/packages/illuminate-console)[timokoerber/laravel-one-time-operations

Run operations once after deployment - just like you do it with migrations!

6481.7M11](/packages/timokoerber-laravel-one-time-operations)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[nagy/laravel-rating

manage rating column for elqouent models

21621.1k](/packages/nagy-laravel-rating)[illuminate/process

The Illuminate Process package.

44699.5k65](/packages/illuminate-process)[muhammadsadeeq/laravel-activitylog-ui

A beautiful, modern UI for Spatie's Activity Log with advanced filtering, analytics, and real-time features.

17510.1k](/packages/muhammadsadeeq-laravel-activitylog-ui)

PHPackages © 2026

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