PHPackages                             gorankrgovic/laravel-reviewable - 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. [Database &amp; ORM](/categories/database)
4. /
5. gorankrgovic/laravel-reviewable

ActiveLibrary[Database &amp; ORM](/categories/database)

gorankrgovic/laravel-reviewable
===============================

Make Laravel Eloquent models Reviewable using UUIDs.

v0.1.5(7y ago)049MITPHPPHP ^7.0

Since Jan 18Pushed 7y ago1 watchersCompare

[ Source](https://github.com/gorankrgovic/laravel-reviewable)[ Packagist](https://packagist.org/packages/gorankrgovic/laravel-reviewable)[ Docs](https://github.com/gorankrgovic/laravel-reviewable)[ RSS](/packages/gorankrgovic-laravel-reviewable/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (8)Versions (10)Used By (0)

Laravel Reviewable (5 Star rating and review)
=============================================

[](#laravel-reviewable-5-star-rating-and-review)

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

[](#introduction)

This package ads the ability for your mdeosl to be reviewable. Basically to add a review system to your application.

Also, worth noting that this package utilizes usage of UUID's instead of integer ID's. And the "Likeable" and "Liker" models needs to utilize UUIDs as well. If you are not using UUID's please be my guest and fork the package to made a non-uuid version.

For the UUID generation this package uses [Ramsey UUID](https://github.com/ramsey/uuid).

Features
--------

[](#features)

- Uses UUIDs instead of integers (your user model must use them as well!)
- Designed to work with Laravel Eloquent models.
- Using contracts to keep high customization capabilities.
- Using traits to get functionality out of the box.
- Most part of the the logic is handled by the `ReviewableService`.
- Subscribes for one model are mutually exclusive.
- Get Reviewable models ordered by reviews count.
- Get Reviewable models ordered by reviews average rating.
- Events for `review`, `unreview` methods.
- Following PHP Standard Recommendations:
    - [PSR-1 (Basic Coding Standard)](http://www.php-fig.org/psr/psr-1/).
    - [PSR-2 (Coding Style Guide)](http://www.php-fig.org/psr/psr-2/).
    - [PSR-4 (Autoloading Standard)](http://www.php-fig.org/psr/psr-4/).

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

[](#installation)

First, pull in the package through Composer.

```
$ composer require gorankrgovic/laravel-reviewable
```

#### Perform Database Migration

[](#perform-database-migration)

At last you need to publish and run database migrations.

```
$ php artisan migrate
```

If you want to make changes in migrations, publish them to your application first.

```
$ php artisan vendor:publish --provider="Gox\Laravel\Reviewable\Providers\ReviewableServiceProvider" --tag=migrations
```

Usage
-----

[](#usage)

### Prepare Reviewer Model

[](#prepare-reviewer-model)

Use `Gox\Contracts\Reviewable\Reviewer\Models\Reviewer` contract in model which will get likes behavior and implement it or just use `Gox\Laravel\Reviewable\Reviewer\Models\Traits\Reviewer` trait.

```
use Gox\Contracts\Reviewable\Reviewer\Models\Reviewer as ReviewerContract;
use Gox\Laravel\Reviewable\Reviewer\Models\Traits\Reviewer;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable implements ReviewerContract
{
    use Reviewer;
}
```

### Prepare Reviewable Model

[](#prepare-reviewable-model)

Use `Gox\Contracts\Reviewable\Reviewable\Models\Reviewable` contract in model which will get likes behavior and implement it or just use `Gox\Laravel\Reviewable\Revieable\Models\Traits\Reviewable` trait.

```
use Gox\Contracts\Reviewable\Reviewable\Models\Reviewable as ReviewableContract;
use Gox\Laravel\Reviewable\Revieable\Models\Traits\Reviewable;
use Illuminate\Database\Eloquent\Model;

class Article extends Model implements ReviewableContract
{
    use Reviewable;
}
```

### Available Methods

[](#available-methods)

#### Reviews

[](#reviews)

##### Review model

[](#review-model)

```
// stars can be from 1 to 5
// Comment can be null
$user->review($article, $star, $comment);
$user->reviewPoor($article, $comment);
$user->reviewBad($article, $comment);
$user->reviewOk($article, $comment);
$user->reviewGood($article, $comment);
$user->reviewGreat($article, $comment);

$article->reviewBy($star, $comment); // current user
$article->reviewBy($star, $comment, $user->id);
```

##### Remove review mark from model

[](#remove-review-mark-from-model)

```
$user->unreview($article);

$article->unreviewBy(); // current user
$article->unreviewBy($user->id);
```

##### Get model reviews count

[](#get-model-reviews-count)

```
$article->reviewsCount;
```

##### Get model reviews avg

[](#get-model-reviews-avg)

```
$article->reviewsAverage;
```

##### Get model reviews counter

[](#get-model-reviews-counter)

```
$article->reviewsCounter;
```

##### Get reviews relation

[](#get-reviews-relation)

```
$article->reviews();
```

##### Boolean check if user reviewed model

[](#boolean-check-if-user-reviewed-model)

```
$user->hasReviewed($article);

$article->reviewed; // current user
$article->isReviewedBy(); // current user
$article->isReviewedBy($user->id);
```

##### Delete all reviews for model

[](#delete-all-reviews-for-model)

```
$article->removeReviews();
```

### Scopes

[](#scopes)

##### Find all articles reviewed by user

[](#find-all-articles-reviewed-by-user)

```
Article::whereReviewedBy($user->id)
    ->with('reviewsCounter') // Allow eager load (optional)
    ->get();
```

##### Fetch Reviewable models by reviews count

[](#fetch-reviewable-models-by-reviews-count)

```
$sortedArticles = Article::orderByReviewsCount()->get();
$sortedArticles = Article::orderByReviewsCount('asc')->get();
$sortedArticles = Article::orderByReviewsAvg()->get();
$sortedArticles = Article::orderByReviewsAvg('asc')->get();
```

*Uses `desc` as default order direction.*

### Events

[](#events)

On each like added `\Gox\Laravel\Reviewable\Reviewable\Events\ReviewableWasReviewed` event is fired.

On each like removed `\Gox\Laravel\Reviewable\Reviewable\Events\ReviewableWasUnreviewed` event is fired.

Security
--------

[](#security)

If you discover any security related issues, please email me instead of using the issue tracker.

License
-------

[](#license)

- `Laravel Reviewable` package is open-sourced software licensed under the [MIT license](LICENSE) by Goran Krgovic.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

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

Recently: every ~14 days

Total

9

Last Release

2614d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/dc897661efd3f9b1d0b6cee6fa6eb2f5535819e0c2e0a0adab66b4d6002133be?d=identicon)[gorankrgovic](/maintainers/gorankrgovic)

---

Top Contributors

[![diginf](https://avatars.githubusercontent.com/u/38245589?v=4)](https://github.com/diginf "diginf (9 commits)")

---

Tags

laraveleloquenttraituuidreviewgorankrgovic5star

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/gorankrgovic-laravel-reviewable/health.svg)

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

###  Alternatives

[dyrynda/laravel-model-uuid

This package allows you to easily work with UUIDs in your Laravel models.

4802.8M8](/packages/dyrynda-laravel-model-uuid)[cybercog/laravel-ban

Laravel Ban simplify blocking and banning Eloquent models.

1.1k651.8k11](/packages/cybercog-laravel-ban)[cybercog/laravel-love

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

1.2k302.7k1](/packages/cybercog-laravel-love)[cviebrock/eloquent-taggable

Easy ability to tag your Eloquent models in Laravel.

567694.8k3](/packages/cviebrock-eloquent-taggable)[rtconner/laravel-likeable

Trait for Laravel Eloquent models to allow easy implementation of a 'like' or 'favorite' or 'remember' feature.

394388.0k5](/packages/rtconner-laravel-likeable)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.2M13](/packages/reedware-laravel-relation-joins)

PHPackages © 2026

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