PHPackages                             abdullahfaqeir/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. [Database &amp; ORM](/categories/database)
4. /
5. abdullahfaqeir/laravel-rating

ActiveLibrary[Database &amp; ORM](/categories/database)

abdullahfaqeir/laravel-rating
=============================

Manage rating column for elqouent models

v3.0(4y ago)131↓100%MITPHPPHP ^8.0

Since Jan 22Pushed 4y agoCompare

[ Source](https://github.com/AbdullahFaqeir/Laravel-rating)[ Packagist](https://packagist.org/packages/abdullahfaqeir/laravel-rating)[ Docs](https://github.com/AbdullahFaqeir/Laravel-rating)[ GitHub Sponsors](https://github.com/AbdullahFaqeir)[ RSS](/packages/abdullahfaqeir-laravel-rating/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (11)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 is an updated and maintained fork of [Laravel-rating](https://github.com/mohamednagy/Laravel-rating)

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/AbdullahFaqeir/Laravel-rating#install)
- [![](https://camo.githubusercontent.com/583681c31301a5e17e0860d1375bbbefc406f2a44543e4e329f389d2b9ae560d/68747470733a2f2f696d6167652e6962622e636f2f65474b5067772f69665f3031395f537461725f323739323934372e706e67)](https://camo.githubusercontent.com/583681c31301a5e17e0860d1375bbbefc406f2a44543e4e329f389d2b9ae560d/68747470733a2f2f696d6167652e6962622e636f2f65474b5067772f69665f3031395f537461725f323739323934372e706e67) [Rating](https://github.com/AbdullahFaqeir/Laravel-rating#rating)
- [![](./media/like-dislike.png)](./media/like-dislike.png) [Like &amp; Dislike](https://github.com/AbdullahFaqeir/Laravel-rating#like--dislike)
- [![](https://camo.githubusercontent.com/c622d7b2c4e679f027bea8b5132fb21e08c19a18784c81daff91dd61ef1b16b8/68747470733a2f2f696d6167652e6962622e636f2f6867636f38622f69665f63686576726f6e5f75705f3137333138302e706e67)](https://camo.githubusercontent.com/c622d7b2c4e679f027bea8b5132fb21e08c19a18784c81daff91dd61ef1b16b8/68747470733a2f2f696d6167652e6962622e636f2f6867636f38622f69665f63686576726f6e5f75705f3137333138302e706e67) [Voting](https://github.com/AbdullahFaqeir/Laravel-rating#voting)

Rating
------

[](#rating)

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

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

class User extends Model
{
    use CanRate;
```

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

```
use AbdullahFaqeir\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 AbdullahFaqeir\LaravelRating\Traits\Vote\CanVote;

class User extends Model
{
    use CanVote;
```

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

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

class User extends Model
{
    use CanLike;
```

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

```
use AbdullahFaqeir\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 9.\* , 8.\*

```
composer require abdullahfaqeir/laravel-rating
```

in your config/app.php

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

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

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor1

Top contributor holds 52.6% 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 ~188 days

Recently: every ~177 days

Total

9

Last Release

1524d ago

Major Versions

v1.4 → v2.02021-03-09

v2.2 → v3.02022-03-10

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

v1.3PHP ^7.2

v2.0PHP ^8.0|^7.3

v3.0PHP ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1428547?v=4)[Abdullah Al-Faqeir](/maintainers/AbdullahFaqeir)[@AbdullahFaqeir](https://github.com/AbdullahFaqeir)

---

Top Contributors

[![nagi1](https://avatars.githubusercontent.com/u/16584220?v=4)](https://github.com/nagi1 "nagi1 (30 commits)")[![mohamednagy](https://avatars.githubusercontent.com/u/10484012?v=4)](https://github.com/mohamednagy "mohamednagy (20 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)")[![malijani](https://avatars.githubusercontent.com/u/40851133?v=4)](https://github.com/malijani "malijani (1 commits)")[![marvinhosea](https://avatars.githubusercontent.com/u/7722584?v=4)](https://github.com/marvinhosea "marvinhosea (1 commits)")[![AbdullahFaqeir](https://avatars.githubusercontent.com/u/1428547?v=4)](https://github.com/AbdullahFaqeir "AbdullahFaqeir (1 commits)")[![zlokomatic](https://avatars.githubusercontent.com/u/5440?v=4)](https://github.com/zlokomatic "zlokomatic (1 commits)")[![Daniyal-Javani](https://avatars.githubusercontent.com/u/8044163?v=4)](https://github.com/Daniyal-Javani "Daniyal-Javani (1 commits)")

---

Tags

laravel-ratingnagy

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-backup

A Laravel package to backup your application

6.0k21.8M191](/packages/spatie-laravel-backup)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[bavix/laravel-wallet

It's easy to work with a virtual wallet.

1.3k1.1M11](/packages/bavix-laravel-wallet)[dyrynda/laravel-model-uuid

This package allows you to easily work with UUIDs in your Laravel models.

4802.8M8](/packages/dyrynda-laravel-model-uuid)[clickbar/laravel-magellan

This package provides functionality for working with the postgis extension in Laravel.

423715.4k1](/packages/clickbar-laravel-magellan)[spatie/laravel-sql-commenter

Add comments to SQL queries made by Laravel

1931.4M1](/packages/spatie-laravel-sql-commenter)

PHPackages © 2026

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