Skip to content

Latest commit

 

History

155 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Review Rateable

Packagist downloads Latest release Tests License: MIT

Laravel Review Rateable is an MIT-licensed package for attaching written reviews and multiple rating criteria to any Eloquent model. Core provides the review engine and APIs; your application owns its interface, authentication, authorization, and upload flow.

Core documentation · Live demo · Packagist

Upgrading from v1? Version 2 is an architectural rewrite, not an in-place upgrade. Plan a data migration and update your integration to the new trait and service contract. See the installation guide.

Features

  • Reviews and multiple configurable rating criteria on any Eloquent model
  • Departments with their own rating keys and labels
  • Approval controls and approved-review queries
  • Optional, ordered review images with application-supplied thumbnails
  • Averages, distributions, counts, and a decoupled service contract

ReviewRateable Pro

ReviewRateable Pro — ready-made review interfaces for Livewire, React, and Vue

Core is complete, MIT licensed, and works independently. ReviewRateable Pro is an optional commercial companion built on the same review data. It adds ready-made Livewire, React, and Vue interfaces plus moderation, replies, invitations, verified reviews, helpful voting, and other application workflows.

Requirements

  • PHP 8.1 or higher, subject to your Laravel version's PHP requirements
  • Laravel 10, 11, 12, or 13
  • Compatible numeric IDs for reviewable models and users; the current Core schema does not support UUID identity

Installation

In your Laravel application:

composer require codebyray/laravel-review-rateable:^2.2

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

Laravel discovers the service provider automatically. Publish each migration once; publishing again can create duplicate timestamped migrations. Review images use a separate opt-in migration, so the basic installation creates only reviews and ratings tables.

For upgrades, configuration, and production considerations, see the full installation guide.

Quick start

Add the trait to a saved Eloquent model:

namespace App\Models;

use Codebyray\ReviewRateable\Traits\ReviewRateable;
use Illuminate\Database\Eloquent\Model;

class Product extends Model
{
    use ReviewRateable;
}

Then create a review using keys from the configured default department:

$review = $product->addReview([
    'review' => 'Comfortable and well made.',
    'department' => 'default',
    'recommend' => true,
    'ratings' => [
        'overall' => 5,
        'customer_service' => 5,
        'quality' => 5,
        'price' => 4,
    ],
], auth()->id());

$publishedReviews = $product->getReviews(); // Approved reviews with ratings.

In an HTTP endpoint, authenticate the author, authorize the product, and validate the text and configured rating keys before calling addReview(). New reviews are unapproved by default. See the review API guide for a controller example, updates, approval, deletion, and the injectable service.

Full documentation

The Core documentation is the maintained reference for configuration, review queries and statistics, and review images, galleries, and file lifecycle.

Testing

composer test

License and contributions

Core is MIT licensed. Bug reports, questions, and contributions are welcome through GitHub issues.

About

A flexible Laravel package for adding reviews, multi-criteria ratings, approval workflows, and optional image attachments to any Eloquent model.

Topics

Resources

Stars

310 stars

Watchers

3 watching

Forks

Releases

Sponsor this project

Used by

Contributors

Languages