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

ActiveLibrary

daniyal-javani/laravel-rating
=============================

manage rating column for elqouent models

v1.5(5y ago)0417MITPHPPHP ^7.3

Since Jan 22Pushed 5y agoCompare

[ Source](https://github.com/Daniyal-Javani/Laravel-rating)[ Packagist](https://packagist.org/packages/daniyal-javani/laravel-rating)[ RSS](/packages/daniyal-javani-laravel-rating/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (9)Used By (0)

 [![](https://camo.githubusercontent.com/583681c31301a5e17e0860d1375bbbefc406f2a44543e4e329f389d2b9ae560d/68747470733a2f2f696d6167652e6962622e636f2f65474b5067772f69665f3031395f537461725f323739323934372e706e67)](https://camo.githubusercontent.com/583681c31301a5e17e0860d1375bbbefc406f2a44543e4e329f389d2b9ae560d/68747470733a2f2f696d6167652e6962622e636f2f65474b5067772f69665f3031395f537461725f323739323934372e706e67) [![](https://camo.githubusercontent.com/5cd453f6ebb9831adf63e2812c591d95ce4d54c42f9642938399c4a570e896f3/68747470733a2f2f696d6167652e6962622e636f2f6e4b426e31772f69665f6c696b655f7468756d62735f75705f68616e645f736f6369616c5f6d656469615f313136393135392e706e67)](https://camo.githubusercontent.com/5cd453f6ebb9831adf63e2812c591d95ce4d54c42f9642938399c4a570e896f3/68747470733a2f2f696d6167652e6962622e636f2f6e4b426e31772f69665f6c696b655f7468756d62735f75705f68616e645f736f6369616c5f6d656469615f313136393135392e706e67) [![](https://camo.githubusercontent.com/faa40f6485bce312b4a0475d6b7263f6a02dd2c37b23cbd6364f1ad6f2310734/68747470733a2f2f696d6167652e6962622e636f2f6a71307254622f69665f7468756d62735f646f776e5f68616e645f736f6369616c5f6d656469615f6469736c696b655f313136393137342e706e67)](https://camo.githubusercontent.com/faa40f6485bce312b4a0475d6b7263f6a02dd2c37b23cbd6364f1ad6f2310734/68747470733a2f2f696d6167652e6962622e636f2f6a71307254622f69665f7468756d62735f646f776e5f68616e645f736f6369616c5f6d656469615f6469736c696b655f313136393137342e706e67) [![](https://camo.githubusercontent.com/c622d7b2c4e679f027bea8b5132fb21e08c19a18784c81daff91dd61ef1b16b8/68747470733a2f2f696d6167652e6962622e636f2f6867636f38622f69665f63686576726f6e5f75705f3137333138302e706e67)](https://camo.githubusercontent.com/c622d7b2c4e679f027bea8b5132fb21e08c19a18784c81daff91dd61ef1b16b8/68747470733a2f2f696d6167652e6962622e636f2f6867636f38622f69665f63686576726f6e5f75705f3137333138302e706e67) [![](https://camo.githubusercontent.com/0151589f2027f2afb2075f319a8775937bef788db272fdf16b15045baa95848f/68747470733a2f2f696d6167652e6962622e636f2f62414e7a45472f69665f63686576726f6e5f646f776e5f3137333137372e706e67)](https://camo.githubusercontent.com/0151589f2027f2afb2075f319a8775937bef788db272fdf16b15045baa95848f/68747470733a2f2f696d6167652e6962622e636f2f62414e7a45472f69665f63686576726f6e5f646f776e5f3137333137372e706e67)

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/mohamednagy/Laravel-rating#install)
- [![](https://camo.githubusercontent.com/583681c31301a5e17e0860d1375bbbefc406f2a44543e4e329f389d2b9ae560d/68747470733a2f2f696d6167652e6962622e636f2f65474b5067772f69665f3031395f537461725f323739323934372e706e67)](https://camo.githubusercontent.com/583681c31301a5e17e0860d1375bbbefc406f2a44543e4e329f389d2b9ae560d/68747470733a2f2f696d6167652e6962622e636f2f65474b5067772f69665f3031395f537461725f323739323934372e706e67) [Rating](https://github.com/mohamednagy/Laravel-rating#rating)
- [![](https://camo.githubusercontent.com/5cd453f6ebb9831adf63e2812c591d95ce4d54c42f9642938399c4a570e896f3/68747470733a2f2f696d6167652e6962622e636f2f6e4b426e31772f69665f6c696b655f7468756d62735f75705f68616e645f736f6369616c5f6d656469615f313136393135392e706e67)](https://camo.githubusercontent.com/5cd453f6ebb9831adf63e2812c591d95ce4d54c42f9642938399c4a570e896f3/68747470733a2f2f696d6167652e6962622e636f2f6e4b426e31772f69665f6c696b655f7468756d62735f75705f68616e645f736f6369616c5f6d656469615f313136393135392e706e67) [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/mohamednagy/Laravel-rating#voting)

Rating
------

[](#rating)

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

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

class User extends Model
{
    use CanRate;

```

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

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

class Post extends Model
{
    use Rateable;

```

now you can rate your models as the following:

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

```

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 Nagy\LaravelRating\Traits\Vote\CanVote;

class User extends Model
{
    use CanVote;

```

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

```
use Nagy\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 Nagy\LaravelRating\Traits\Like\CanLike;

class User extends Model
{
    use CanLike;

```

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

```
use Nagy\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 7.\*

```
$ composer require nagy/laravel-rating:^1.4

```

for laravel 6.\*

```
$ composer require nagy/laravel-rating:^1.3

```

for laravel 5.\*

```
$ composer require nagy/laravel-rating:^1.2

```

in your config/app.php

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

    'aliases' => [
        ...
        "LaravelRating" => \Nagy\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

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 69% 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 ~195 days

Recently: every ~177 days

Total

6

Last Release

2055d ago

PHP version history (3 changes)v1.1PHP ^7.0

v1.3PHP ^7.2

v1.5PHP ^7.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/d69dc3f2aa50a51eeadfb5755ad428d4a94db440c9947bfc216274a7d92060e3?d=identicon)[daniyal.javani](/maintainers/daniyal.javani)

---

Top Contributors

[![mohamednagy](https://avatars.githubusercontent.com/u/10484012?v=4)](https://github.com/mohamednagy "mohamednagy (20 commits)")[![Daniyal-Javani](https://avatars.githubusercontent.com/u/8044163?v=4)](https://github.com/Daniyal-Javani "Daniyal-Javani (5 commits)")[![dsone](https://avatars.githubusercontent.com/u/3825633?v=4)](https://github.com/dsone "dsone (1 commits)")[![Dylan-DPC](https://avatars.githubusercontent.com/u/99973273?v=4)](https://github.com/Dylan-DPC "Dylan-DPC (1 commits)")[![marvinhosea](https://avatars.githubusercontent.com/u/7722584?v=4)](https://github.com/marvinhosea "marvinhosea (1 commits)")[![zlokomatic](https://avatars.githubusercontent.com/u/5440?v=4)](https://github.com/zlokomatic "zlokomatic (1 commits)")

### Embed Badge

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

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

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

44643.1k1](/packages/pressbooks-pressbooks)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)[dragon-code/migrate-db

Easy data transfer from one database to another

15717.4k](/packages/dragon-code-migrate-db)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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