PHPackages                             laravel-interaction/rate - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. laravel-interaction/rate

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

laravel-interaction/rate
========================

User rate/unrate behaviour for Laravel.

3.5.0(1mo ago)1164MITPHPPHP ^8.0CI failing

Since Apr 16Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/laravel-interaction/rate)[ Packagist](https://packagist.org/packages/laravel-interaction/rate)[ Docs](https://github.com/laravel-interaction/rate)[ RSS](/packages/laravel-interaction-rate/feed)WikiDiscussions master Synced 5d ago

READMEChangelog (2)Dependencies (12)Versions (28)Used By (0)

Laravel Rate
============

[](#laravel-rate)

User rate/unrate behaviour for Laravel.

[![Latest Stable Version](https://camo.githubusercontent.com/9a44a52fc1ceba6afa05c04cbc22f4fc715a0a28870baf22a032d7af337bda1c/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d696e746572616374696f6e2f726174652f762f737461626c652e737667)](https://packagist.org/packages/laravel-interaction/rate)[![Total Downloads](https://camo.githubusercontent.com/a96466fd4c62d5404e5d43d195443f8c972d726657955eedccb7fab831be4e00/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d696e746572616374696f6e2f726174652f646f776e6c6f616473)](https://packagist.org/packages/laravel-interaction/rate)[![Latest Unstable Version](https://camo.githubusercontent.com/7ef9b3857eaddeff3f4cc66dc6c0256b811aaabec76579182192eabcc8223706/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d696e746572616374696f6e2f726174652f762f756e737461626c652e737667)](https://packagist.org/packages/laravel-interaction/rate)[![License](https://camo.githubusercontent.com/cdb798d9185fb7aaee6790610aec76a7627c9855ae86959622c328bc1dbe45b6/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d696e746572616374696f6e2f726174652f6c6963656e7365)](https://packagist.org/packages/laravel-interaction/rate)

Introduction
------------

[](#introduction)

It let people express how they feel about the model(documentation/subject/service), help other users understand the model better.

[![](https://camo.githubusercontent.com/1a426eab52e24c5a866136f9601c6b4793628b7d0d9ad008cecb0cd5614c86ce/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f726174696e672d2545322539382538352545322539382538352545322539382538352545322539382538352545322539382538362d627269676874677265656e)](https://camo.githubusercontent.com/1a426eab52e24c5a866136f9601c6b4793628b7d0d9ad008cecb0cd5614c86ce/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f726174696e672d2545322539382538352545322539382538352545322539382538352545322539382538352545322539382538362d627269676874677265656e)

Installation
------------

[](#installation)

### Requirements

[](#requirements)

- [PHP 8.0+](https://php.net/releases/)
- [Composer](https://getcomposer.org)
- [Laravel 8.0+](https://laravel.com/docs/releases)

### Instructions

[](#instructions)

Require Laravel Rate using [Composer](https://getcomposer.org).

```
composer require laravel-interaction/rate
```

Publish configuration and migrations

```
php artisan vendor:publish --tag=rate-config
php artisan vendor:publish --tag=rate-migrations
```

Run database migrations.

```
php artisan migrate
```

Usage
-----

[](#usage)

### Setup Rater

[](#setup-rater)

```
use Illuminate\Database\Eloquent\Model;
use LaravelInteraction\Rate\Concerns\Rater;

class User extends Model
{
    use Rater;
}
```

### Setup Ratable

[](#setup-ratable)

```
use Illuminate\Database\Eloquent\Model;
use LaravelInteraction\Rate\Concerns\Ratable;

class Channel extends Model
{
    use Ratable;
}
```

### Rater

[](#rater)

```
use LaravelInteraction\Rate\Tests\Models\Channel;
/** @var \LaravelInteraction\Rate\Tests\Models\User $user */
/** @var \LaravelInteraction\Rate\Tests\Models\Channel $channel */
// Rate to Ratable
$user->rate($channel);
// rate is only allowed to be called once
$user->rateOnce($channel);
$user->unrate($channel);
$user->toggleRate($channel);

// Compare Ratable
$user->hasRated($channel);
$user->hasNotRated($channel);

// Get rated info
$user->raterRatings()->count();

// with type
$user->raterRatings()->withType(Channel::class)->count();

// get rated channels
Channel::query()->whereRatedBy($user)->get();

// get rated channels doesnt rated
Channel::query()->whereNotRatedBy($user)->get();
```

### Ratable

[](#ratable)

```
use LaravelInteraction\Rate\Tests\Models\User;
use LaravelInteraction\Rate\Tests\Models\Channel;
/** @var \LaravelInteraction\Rate\Tests\Models\User $user */
/** @var \LaravelInteraction\Rate\Tests\Models\Channel $channel */
// Compare Rater
$channel->isRatedBy($user);
$channel->isNotRatedBy($user);
// Get raters info
$channel->raters->each(function (User $user){
    echo $user->getKey();
});
$channel->loadRatersCount();
$channels = Channel::query()->withRatersCount()->get();
$channels->each(function (Channel $channel){
    echo $channel->raters()->count(); // 1100
    echo $channel->raters_count; // "1100"
    echo $channel->ratersCount(); // 1100
    echo $channel->ratersCountForHumans(); // "1.1K"
});
```

### Events

[](#events)

EventFired`LaravelInteraction\Rate\Events\Rated`When an object get rated.`LaravelInteraction\Rate\Events\Rerated`When an object get rerated.`LaravelInteraction\Rate\Events\Unrated`When an object get unrated.License
-------

[](#license)

Laravel Rate is an open-sourced software licensed under the [MIT license](LICENSE).

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance88

Actively maintained with recent releases

Popularity12

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

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

Recently: every ~274 days

Total

27

Last Release

59d ago

Major Versions

0.6.0 → 1.0.0-alpha.12021-08-28

0.6.1 → 1.0.0-alpha.22021-08-31

1.x-dev → 2.0.0-beta.12022-03-10

2.x-dev → 3.0.02022-11-27

PHP version history (3 changes)0.0.1PHP ^7.2 || ^8.0

2.0.0-beta.1PHP ^7.3 || ^8.0

3.0.0PHP ^8.0

### Community

Maintainers

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

---

Top Contributors

[![zingimmick](https://avatars.githubusercontent.com/u/26657141?v=4)](https://github.com/zingimmick "zingimmick (46 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (2 commits)")

---

Tags

laravelrateratinglaravelRateRating

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/laravel-interaction-rate/health.svg)

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

###  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)[cybercog/laravel-love

Make Laravel Eloquent models reactable with any type of emotions in a minutes!

1.2k302.7k1](/packages/cybercog-laravel-love)[willvincent/laravel-rateable

Allows multiple models to be rated with a fivestar like system.

416452.0k3](/packages/willvincent-laravel-rateable)[codebyray/laravel-review-rateable

Review &amp; Rating system for Laravel 10, 11 &amp; 12

310351.9k](/packages/codebyray-laravel-review-rateable)[ghanem/rating

Rating system for Laravel

8615.5k](/packages/ghanem-rating)[laravel-interaction/bookmark

User bookmark/unbookmark behaviour for Laravel.

105.0k](/packages/laravel-interaction-bookmark)

PHPackages © 2026

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