PHPackages                             laravel-interaction/vote - 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. laravel-interaction/vote

ActiveLibrary

laravel-interaction/vote
========================

User upvote/downvote behaviour for Laravel.

3.5.0(1mo ago)3648MITPHPPHP ^8.0CI failing

Since Jan 26Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/laravel-interaction/vote)[ Packagist](https://packagist.org/packages/laravel-interaction/vote)[ Docs](https://github.com/laravel-interaction/vote)[ RSS](/packages/laravel-interaction-vote/feed)WikiDiscussions master Synced today

READMEChangelog (6)Dependencies (12)Versions (35)Used By (0)

Laravel Vote
============

[](#laravel-vote)

User upvote/downvote behaviour for Laravel.

[![Latest Stable Version](https://camo.githubusercontent.com/12042685b3d6d82b1faf7257df08e6aec3801e1e652f1571b28f8bd2bdad784c/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d696e746572616374696f6e2f766f74652f762f737461626c652e737667)](https://packagist.org/packages/laravel-interaction/vote)[![Total Downloads](https://camo.githubusercontent.com/b4c55e22ac73a71561e379427be517e857cfd556c82028e1afc6b50567461494/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d696e746572616374696f6e2f766f74652f646f776e6c6f616473)](https://packagist.org/packages/laravel-interaction/vote)[![Latest Unstable Version](https://camo.githubusercontent.com/f010e62305971a0ab5587da541a872616108dc5ce75a3dfd810770918940dae3/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d696e746572616374696f6e2f766f74652f762f756e737461626c652e737667)](https://packagist.org/packages/laravel-interaction/vote)[![License](https://camo.githubusercontent.com/4a6fe1be7a7b292a5c2fd66b127e383daf65600bf05f4a58c53dc01e8ddfc2d9/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d696e746572616374696f6e2f766f74652f6c6963656e7365)](https://packagist.org/packages/laravel-interaction/vote)

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

[](#introduction)

It let people express how they feel about the model(documentation/answer/question), is the model helpful/useful or not.

[![](https://camo.githubusercontent.com/aaf8aee7eac6de58cf31b16728c5c30a7ea76fbb20e5e025fee7697682e4f201/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2546302539462539312538442d312e326b2d677265656e3f7374796c653d736f6369616c)](https://camo.githubusercontent.com/aaf8aee7eac6de58cf31b16728c5c30a7ea76fbb20e5e025fee7697682e4f201/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2546302539462539312538442d312e326b2d677265656e3f7374796c653d736f6369616c) [![](https://camo.githubusercontent.com/6e5f0b11bdb13feaa1ac329d81b92dfb66c22063cc7e25aa3f9d4b81f084a3d0/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2546302539462539312538452d2d677265656e3f7374796c653d736f6369616c)](https://camo.githubusercontent.com/6e5f0b11bdb13feaa1ac329d81b92dfb66c22063cc7e25aa3f9d4b81f084a3d0/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2546302539462539312538452d2d677265656e3f7374796c653d736f6369616c)

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

[](#installation)

### Requirements

[](#requirements)

- [PHP 8.0+](https://php.net/releases/)
- [Composer](https://getcomposer.org)
- [Laravel 8.0+](https://laravel.com/docs/releases)

### Instructions

[](#instructions)

Require Laravel Vote using [Composer](https://getcomposer.org).

```
composer require laravel-interaction/vote
```

Publish configuration and migrations

```
php artisan vendor:publish --tag=vote-config
php artisan vendor:publish --tag=vote-migrations
```

Run database migrations.

```
php artisan migrate
```

Usage
-----

[](#usage)

### Setup Voter

[](#setup-voter)

```
use Illuminate\Database\Eloquent\Model;
use LaravelInteraction\Vote\Concerns\Voter;

class User extends Model
{
    use Voter;
}
```

### Setup Voteable

[](#setup-voteable)

```
use Illuminate\Database\Eloquent\Model;
use LaravelInteraction\Vote\Concerns\Voteable;

class Channel extends Model
{
    use Voteable;
}
```

### Voter

[](#voter)

```
use LaravelInteraction\Vote\Tests\Models\Channel;
/** @var \LaravelInteraction\Vote\Tests\Models\User $user */
/** @var \LaravelInteraction\Vote\Tests\Models\Channel $channel */
// Vote to Voteable
$user->vote($channel);
$user->upvote($channel);
$user->downvote($channel);
$user->cancelVote($channel);

// Compare Voteable
$user->hasVoted($channel);
$user->hasNotVoted($channel);
$user->hasUpvoted($channel);
$user->hasNotUpvoted($channel);
$user->hasDownvoted($channel);
$user->hasNotDownvoted($channel);

// Get voted info
$user->voterVotes()->count();

// with type
$user->voterVotes()->withType(Channel::class)->count();
$user->votedChannels()->count();
$user->upvotedChannels()->count();
$user->downvotedChannels()->count();

// get voted channels
Channel::query()->whereVotedBy($user)->get();
Channel::query()->whereUpvotedBy($user)->get();
Channel::query()->whereDownvotedBy($user)->get();

// get voted channels doesnt voted
Channel::query()->whereNotVotedBy($user)->get();
Channel::query()->whereNotUpvotedBy($user)->get();
Channel::query()->whereNotDownvotedBy($user)->get();
```

### Voteable

[](#voteable)

```
use LaravelInteraction\Vote\Tests\Models\User;
use LaravelInteraction\Vote\Tests\Models\Channel;
/** @var \LaravelInteraction\Vote\Tests\Models\User $user */
/** @var \LaravelInteraction\Vote\Tests\Models\Channel $channel */
// Compare Voter
$channel->isVotedBy($user);
$channel->isNotVotedBy($user);
$channel->isUpvotedBy($user);
$channel->isNotUpvotedBy($user);
$channel->isDownvotedBy($user);
$channel->isNotDownvotedBy($user);
// Get voters info
$channel->voters->each(function (User $user){
    echo $user->getKey();
});
$channel->upvoters->each(function (User $user){
    echo $user->getKey();
});
$channel->downvoters->each(function (User $user){
    echo $user->getKey();
});

$channels = Channel::query()->withCount('voters')->get();
$channels->each(function (Channel $channel){
    echo $channel->voters()->count(); // 1100
    echo $channel->voters_count; // "1100"
    echo $channel->votersCount(); // 1100
    echo $channel->votersCountForHumans(); // "1.1K"
    echo $channel->upvoters()->count(); // 1100
    echo $channel->upvoters_count; // "1100"
    echo $channel->upvotersCount(); // 1100
    echo $channel->upvotersCountForHumans(); // "1.1K"
    echo $channel->downvoters()->count(); // 1100
    echo $channel->downvoters_count; // "1100"
    echo $channel->downvotersCount(); // 1100
    echo $channel->downvotersCountForHumans(); // "1.1K"
});
```

### Events

[](#events)

EventFired`LaravelInteraction\Vote\Events\Voted`When an object get voted/upvoted/downvoted.`LaravelInteraction\Vote\Events\VoteCanceled`When an object get vote cancellation.License
-------

[](#license)

Laravel Vote is an open-sourced software licensed under the [MIT license](LICENSE).

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance90

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

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

Recently: every ~274 days

Total

34

Last Release

53d ago

Major Versions

0.6.0 → 1.0.0-alpha.12021-08-28

0.6.1 → 1.0.0-alpha.22021-08-31

1.x-dev → 2.0.0-beta.12022-03-10

2.0.0 → 3.0.02022-11-27

PHP version history (3 changes)0.0.1PHP ^7.2 || ^8.0

2.0.0-beta.1PHP ^7.3 || ^8.0

3.0.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/5fafa5bffa28dcd722432b244bf3f0bfe773406df29fea295847e2397b95d50b?d=identicon)[zingimmick](/maintainers/zingimmick)

---

Top Contributors

[![zingimmick](https://avatars.githubusercontent.com/u/26657141?v=4)](https://github.com/zingimmick "zingimmick (80 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (3 commits)")

---

Tags

laravelvotelaravelvote

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/laravel-interaction-vote/health.svg)

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

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M686](/packages/barryvdh-laravel-ide-helper)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)[laravel-interaction/bookmark

User bookmark/unbookmark behaviour for Laravel.

105.0k](/packages/laravel-interaction-bookmark)

PHPackages © 2026

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