LaravelPackages.net
Acme Inc.
Toggle sidebar
roundly-consulting/reviews-for-laravel

Write reviews to any entity from any entity.

99
5
1.2.0
About roundly-consulting/reviews-for-laravel

roundly-consulting/reviews-for-laravel is a Laravel package for write reviews to any entity from any entity.. It currently has 5 GitHub stars and 99 downloads on Packagist (latest version 1.2.0). Install it with composer require roundly-consulting/reviews-for-laravel. Discover more Laravel packages by roundly-consulting or browse all Laravel packages to compare alternatives.

Last updated

Reviews for Laravel — Roundly open source

Latest release Tests Code style Donate Patreon Crypto

Reviews for Laravel

Ratings and reviews for any Eloquent model — users review products, businesses review users, anything can review anything. Star ratings, a moderation lifecycle, verified purchases, helpful votes, owner responses, review photos and cached aggregates, behind one fluent facade.

Installation

Requires PHP 8.4 and Laravel 12 or 13.

composer require roundly-consulting/reviews-for-laravel
php artisan vendor:publish --tag="reviews-migrations"
php artisan vendor:publish --tag="media-migrations"   # review photos live in media-library
php artisan migrate

If the models being reviewed, writing reviews or voting have UUID/ULID keys, set REVIEWS_KEY_TYPE=uuid (or ulid) before migrating.

Usage

Make a model reviewable and another one a reviewer:

use RoundlyConsulting\Reviews\Concerns\CanReview;
use RoundlyConsulting\Reviews\Concerns\HasReviews;

class Product extends Model
{
    use HasReviews;
}

class User extends Authenticatable
{
    use CanReview;
}

Then write, moderate and read reviews:

use RoundlyConsulting\Reviews\Facades\Reviews;

$review = Reviews::for($product)->by($user)
    ->rating(5)
    ->title('Loved it')
    ->content('Great value for the price')
    ->verified()                                    // a verified purchase
    ->create();                                     // lands as pending

Reviews::approve($review);
Reviews::respond($review, $owner, 'Thanks for the feedback!');
Reviews::vote($review, $shopper, helpful: true);

Reviews::for($product)->average();                  // 5.0
Reviews::for($product)->distribution();             // [5 => 1]
Reviews::for($product)->query()->approved()->mostHelpful()->paginate();

Documentation

The full documentation — configuration, every feature and its API, and testing — lives on our website: roundly-consulting.com/open-source/docs/reviews-for-laravel

Release notes are in CHANGELOG.md. To contribute, see the contributing guide.

Support our work

This package is free and open source, built and maintained by Roundly Consulting. If it saves you time, please consider supporting our open-source work — a one-time donation, a monthly pledge on Patreon or a crypto donation helps fund maintenance, new features and new packages.

Donate to Roundly open source Become a patron on Patreon Donate crypto: BTC, ETH, BNB or SOL

License

The MIT License (MIT). Please see License File for more information.

Comments