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

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

codebyray/laravel-review-rateable
=================================

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

v2.1.4(4w ago)309358.3k↑15.7%56MITPHPPHP &gt;=8.1CI passing

Since Oct 26Pushed 4w ago3 watchersCompare

[ Source](https://github.com/codebyray/laravel-review-rateable)[ Packagist](https://packagist.org/packages/codebyray/laravel-review-rateable)[ GitHub Sponsors](https://github.com/codebyray)[ RSS](/packages/codebyray-laravel-review-rateable/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (10)Dependencies (10)Versions (22)Used By (0)

Laravel Review Rateable
=======================

[](#laravel-review-rateable)

[![Packagist Downloads](https://camo.githubusercontent.com/59c320089b529072f34529d9af5be10dc2aac89afd9f2ac2224f7c8a80dfefaf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f646562797261792f6c61726176656c2d7265766965772d7261746561626c65)](https://camo.githubusercontent.com/59c320089b529072f34529d9af5be10dc2aac89afd9f2ac2224f7c8a80dfefaf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f646562797261792f6c61726176656c2d7265766965772d7261746561626c65) [![GitHub](https://camo.githubusercontent.com/31d25dc3334f395b6f7f4b9c7b5e45ad94af9f9c2bcf347be2af3d6db1609249/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f636f646562797261792f6c61726176656c2d7265766965772d7261746561626c65)](https://camo.githubusercontent.com/31d25dc3334f395b6f7f4b9c7b5e45ad94af9f9c2bcf347be2af3d6db1609249/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f636f646562797261792f6c61726176656c2d7265766965772d7261746561626c65) [![GitHub release (latest SemVer)](https://camo.githubusercontent.com/a05d9882a558c021b5bdf98cb04de9215fde65f5bf1930c785a1fd05fdc224d3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f636f646562797261792f6c61726176656c2d7265766965772d7261746561626c65)](https://camo.githubusercontent.com/a05d9882a558c021b5bdf98cb04de9215fde65f5bf1930c785a1fd05fdc224d3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f636f646562797261792f6c61726176656c2d7265766965772d7261746561626c65) [![Tests](https://github.com/codebyray/laravel-review-rateable/actions/workflows/tests.yml/badge.svg)](https://github.com/codebyray/laravel-review-rateable/actions/workflows/tests.yml)

> **NOTE: Breaking Changes**This is a complete rewrite from v1. It is not compatible with previous versions of this package. Because v2 is a total architectural overhaul, you cannot simply upgrade; you will need to perform a migration of your existing data and update your implementation to match the new service contract and trait logic.

Laravel Review Ratable is a flexible package that enables you to attach reviews (with multiple ratings) to any Eloquent model in your Laravel application. The package supports multiple departments, configurable rating boundaries, review approval, and a decoupled service contract so you can easily integrate, test, and extend the functionality.

Features
--------

[](#features)

- **Reviews &amp; Ratings:** Attach written reviews along with multiple rating values to any model.
- **Configurable Settings:** Define custom rating keys, labels, and value boundaries (min/max) via a config file.
- **Department Support:** Organize ratings by department (e.g. default, sales, support) with their own criteria.
- **Review Approval:** Set a default approval status for reviews (and override per review if needed).
- **Flexible Data Retrieval:** Retrieve reviews with or without ratings, filter by approval status, and calculate averages.
- **Service Contract:** Use a dedicated service that implements a contract for a decoupled, testable API.

Requirements
------------

[](#requirements)

- PHP 8.1 or higher
- Laravel 10, 11, 12, or 13

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

[](#installation)

### 1. Install via Composer

[](#1-install-via-composer)

In your Laravel application's root, require the package via Composer.

```
composer require codebyray/laravel-review-rateable:^2.0
```

### 2. Publish Package Assets

[](#2-publish-package-assets)

After installation, publish the package config and migration files:

```
php artisan vendor:publish --provider="Codebyray\ReviewRateable\ReviewRateableServiceProvider" --tag=config
php artisan vendor:publish --provider="Codebyray\ReviewRateable\ReviewRateableServiceProvider" --tag=migrations
```

Run the migrations to create the necessary database tables:

```
php artisan migrate
```

Configuration
-------------

[](#configuration)

You can customize the package behavior by publishing the configuration file:

```
php artisan vendor:publish --provider="Codebyray\ReviewRateable\ReviewRateableServiceProvider" --tag=config
```

### User Model Configuration

[](#user-model-configuration)

Ensure the user\_model setting in config/review-rateable.php points to your application's User model:

```
'user_model' => \App\Models\User::class,
```

> Note: If your application uses a custom User model (e.g., App\\Models\\Account), ensure you update this path accordingly.

### Configuration Options

[](#configuration-options)

You can customize the package behavior by modifying config/review-rateable.php:

- User Model: Configure the model used for reviews.
- Rating Value Boundaries:
    - min\_rating\_value: Minimum rating value.
    - max\_rating\_value: Maximum rating value.
- Review Approval:
    - approved\_review: Default approval status for new reviews.
- Departments &amp; Rating Labels: Define multiple departments, each with its own set of rating keys and labels.

Example configuration:

```
