PHPackages                             willvincent/laravel-rateable - 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. willvincent/laravel-rateable

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

willvincent/laravel-rateable
============================

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

3.5.0(1y ago)416452.0k—5.2%93[1 PRs](https://github.com/willvincent/laravel-rateable/pulls)3MITPHPPHP ^8.1 || ^8.2 || ^8.3 || ^8.4CI failing

Since Aug 27Pushed 1y ago9 watchersCompare

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

READMEChangelog (10)Dependencies (4)Versions (25)Used By (3)

Laravel Rateable
================

[](#laravel-rateable)

[![Latest Stable Version](https://camo.githubusercontent.com/dc70afade43a75039b69dad022e39f3fa151a8e03213d52dc51c07641638a350/68747470733a2f2f706f7365722e707567782e6f72672f77696c6c76696e63656e742f6c61726176656c2d7261746561626c652f762f737461626c652e737667)](https://packagist.org/packages/willvincent/laravel-rateable) [![License](https://camo.githubusercontent.com/08a1455777273114aff249b4d96cc81fcc1adbaaa6aa3f46336055045d6f93bc/68747470733a2f2f706f7365722e707567782e6f72672f77696c6c76696e63656e742f6c61726176656c2d7261746561626c652f6c6963656e73652e737667)](https://packagist.org/packages/willvincent/laravel-rateable)

[![Total Downloads](https://camo.githubusercontent.com/f0164160e58ebcd9c2b2ca42d0d6c9b167f462906b9fc3b58b8182f217c0ffc9/68747470733a2f2f706f7365722e707567782e6f72672f77696c6c76696e63656e742f6c61726176656c2d7261746561626c652f646f776e6c6f6164732e737667)](https://packagist.org/packages/willvincent/laravel-rateable) [![Monthly Downloads](https://camo.githubusercontent.com/950099de28209d45de75110cd069e0d709d86d19db71e0c680589d052cf837e5/68747470733a2f2f706f7365722e707567782e6f72672f77696c6c76696e63656e742f6c61726176656c2d7261746561626c652f642f6d6f6e74686c792e706e67)](https://packagist.org/packages/willvincent/laravel-rateable) [![Daily Downloads](https://camo.githubusercontent.com/d00d084e9aecd23bce75932bc748d3b2a41d3b7cd0a7ee8fd7e051ef223e70b6/68747470733a2f2f706f7365722e707567782e6f72672f77696c6c76696e63656e742f6c61726176656c2d7261746561626c652f642f6461696c792e706e67)](https://packagist.org/packages/willvincent/laravel-rateable)

Provides a trait to allow rating of any Eloquent models within your app for Laravel versions 6 and higher.

Ratings could be fivestar style, or simple +1/-1 style.

Compatability
-------------

[](#compatability)

Laravel versions &lt; 6.x should use the 1.x releases

Laravel versions &gt;= 6.x and &lt; 8.x should use 2.x+ releases

Laravel versions &gt;= 8.x should use the 3.x releases

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

[](#installation)

You can install the package via composer:

```
composer require willvincent/laravel-rateable
```

You can publish and run the migrations with:

```
php artisan vendor:publish --provider="willvincent\Rateable\RateableServiceProvider" --tag="migrations"
php artisan migrate
```

As with most Laravel packages, if you're using Laravel 5.5 or later, the package will be auto-discovered ([learn more if this is new to you](https://medium.com/@taylorotwell/package-auto-discovery-in-laravel-5-5-ea9e3ab20518)).

If you're using a version of Laravel before 5.5, you'll need to register the Rateable *service provider*. In your `config/app.php` add `'willvincent\Rateable\RateableServiceProvider'` to the end of the `$providers` array.

```
'providers' => [

    Illuminate\Foundation\Providers\ArtisanServiceProvider::class,
    Illuminate\Auth\AuthServiceProvider::class,
    ...
    willvincent\Rateable\RateableServiceProvider::class,

],
```

Usage
-----

[](#usage)

In order to mark a model as "rateable", import the `Rateable` trait.

```
