PHPackages                             unisharp/ratable - 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. unisharp/ratable

ActiveLibrary

unisharp/ratable
================

let object can be rated

2408PHP

Since May 23Pushed 7y ago9 watchersCompare

[ Source](https://github.com/UniSharp/ratable)[ Packagist](https://packagist.org/packages/unisharp/ratable)[ RSS](/packages/unisharp-ratable/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Ratable
=======

[](#ratable)

Provide a trait to multiple models to rate easliy.

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

[](#installation)

```
composer require unisharp/ratable dev-master

```

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

[](#configuration)

Set provider modules in `config/app.php`

```
return [
    'providers' => [
          UniSharp\Ratable\Providers\RatableServiceProvider:class
    ]
];
```

Usages
------

[](#usages)

Use trait in the model

```
namespace App;

use Illuminate\Database\Eloquent\Model;
use UniSharp\Ratable\Traits\Ratable;

class Movie extends Model
{
    use Ratable;
}
```

Rate your model with grade and/or description

```
$movie = new Movie();

$movie->rates()->create([
  'grade' => 10,
  'description' => 'Excellent'
]);
```

Get your model's average rate

```
$movie = new Movie();

$movie->rates()->saveMany(
  new UniSharp\Ratable\Models\Rate(['grade' => 10, 'description' => 'Excellent'],
  new UniSharp\Ratable\Models\Rate(['grade' => 5, 'description' => 'Not Bad']
);

$movie->average()  // 7.5
```

Get a rate's giver and model

```
$movie = new Movie();

$rate = $movie->rates()->create([
  'grade' => 10,
  'description' => 'Excellent'
]);

// giver
$rate->user;

// model
$rate->ratable;
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1203922?v=4)[FreedomKnight](/maintainers/FreedomKnight)[@FreedomKnight](https://github.com/FreedomKnight)

![](https://www.gravatar.com/avatar/9a2fc2455de09cd6a0cc4fdd640be6a1a2876818531c0a09abcf578528c37b07?d=identicon)[CatheCat](/maintainers/CatheCat)

---

Top Contributors

[![CatheCat](https://avatars.githubusercontent.com/u/14325344?v=4)](https://github.com/CatheCat "CatheCat (2 commits)")[![youchenlee](https://avatars.githubusercontent.com/u/181350?v=4)](https://github.com/youchenlee "youchenlee (1 commits)")

### Embed Badge

![Health badge](/badges/unisharp-ratable/health.svg)

```
[![Health](https://phpackages.com/badges/unisharp-ratable/health.svg)](https://phpackages.com/packages/unisharp-ratable)
```

PHPackages © 2026

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