PHPackages                             laravel-interaction/like - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. laravel-interaction/like

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

laravel-interaction/like
========================

User like/unlike behaviour for Laravel.

3.5.0(1mo ago)4276MITPHPPHP ^8.0

Since Nov 22Pushed 1mo ago1 watchersCompare

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

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

Laravel Like
============

[](#laravel-like)

User like/unlike behaviour for Laravel.

[![Latest Stable Version](https://camo.githubusercontent.com/b96a9c011510884f22408220c7223264b5166b8f1189b9a62e5e06a2178a62fa/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d696e746572616374696f6e2f6c696b652f762f737461626c652e737667)](https://packagist.org/packages/laravel-interaction/like)[![Total Downloads](https://camo.githubusercontent.com/7053975dcdb5ccbc50c1aad8fa160cc68dfae3096596482e51b5b29b03d49547/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d696e746572616374696f6e2f6c696b652f646f776e6c6f616473)](https://packagist.org/packages/laravel-interaction/like)[![Latest Unstable Version](https://camo.githubusercontent.com/88bfb23c711f3e877ac655db7298215ff9aca568b1b045a46b0ae931674c4301/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d696e746572616374696f6e2f6c696b652f762f756e737461626c652e737667)](https://packagist.org/packages/laravel-interaction/like)[![License](https://camo.githubusercontent.com/20312a2a3e6384a8d752695f73df59be1d10747cc122595c9c68032e9da3016b/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d696e746572616374696f6e2f6c696b652f6c6963656e7365)](https://packagist.org/packages/laravel-interaction/like)

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

[](#introduction)

It let people express how they feel about the model(documentation/subject/topic).

[![](https://camo.githubusercontent.com/d204c327ea72a68b35f96c7e0f17139ab8ff894479c5ab3e1e175bcbb3255b18/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2545322539442541342d312e326b2d677265656e3f7374796c653d736f6369616c)](https://camo.githubusercontent.com/d204c327ea72a68b35f96c7e0f17139ab8ff894479c5ab3e1e175bcbb3255b18/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2545322539442541342d312e326b2d677265656e3f7374796c653d736f6369616c)

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 Like using [Composer](https://getcomposer.org).

```
composer require laravel-interaction/like
```

Publish configuration and migrations

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

Run database migrations.

```
php artisan migrate
```

Usage
-----

[](#usage)

### Setup Fan

[](#setup-fan)

```
use Illuminate\Database\Eloquent\Model;
use LaravelInteraction\Like\Concerns\Fan;

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

### Setup Likeable

[](#setup-likeable)

```
use Illuminate\Database\Eloquent\Model;
use LaravelInteraction\Like\Concerns\Likeable;

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

### Fan

[](#fan)

```
use LaravelInteraction\Like\Tests\Models\Channel;
/** @var \LaravelInteraction\Like\Tests\Models\User $user */
/** @var \LaravelInteraction\Like\Tests\Models\Channel $channel */
// Like to Likeable
$user->like($channel);
$user->unlike($channel);
$user->toggleLike($channel);

// Compare Likeable
$user->hasLiked($channel);
$user->hasNotLiked($channel);

// Get liked info
$user->fanLikes()->count();

// with type
$user->fanLikes()->withType(Channel::class)->count();

// get liked channels
Channel::query()->whereLikedBy($user)->get();

// get liked channels doesnt liked
Channel::query()->whereNotLikedBy($user)->get();
```

### Likeable

[](#likeable)

```
use LaravelInteraction\Like\Tests\Models\User;
use LaravelInteraction\Like\Tests\Models\Channel;
/** @var \LaravelInteraction\Like\Tests\Models\User $user */
/** @var \LaravelInteraction\Like\Tests\Models\Channel $channel */
// Compare Fan
$channel->isLikedBy($user);
$channel->isNotLikedBy($user);
// Get fans info
$channel->fans->each(function (User $user){
    echo $user->getKey();
});

$channels = Channel::query()->withCount('fans')->get();
$channels->each(function (Channel $channel){
    echo $channel->fans()->count(); // 1100
    echo $channel->fans_count; // "1100"
    echo $channel->fansCount(); // 1100
    echo $channel->fansCountForHumans(); // "1.1K"
});
```

### Events

[](#events)

EventFired`LaravelInteraction\Like\Events\Liked`When an object get liked.`LaravelInteraction\Like\Events\Unliked`When an object get unliked.License
-------

[](#license)

Laravel Like 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

Popularity15

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 89.6% 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 ~59 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 (95 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (8 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (2 commits)")[![kodiakhq[bot]](https://avatars.githubusercontent.com/in/29196?v=4)](https://github.com/kodiakhq[bot] "kodiakhq[bot] (1 commits)")

---

Tags

laravellikelaravellike

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[barryvdh/laravel-ide-helper

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

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[laravel-interaction/bookmark

User bookmark/unbookmark behaviour for Laravel.

105.0k](/packages/laravel-interaction-bookmark)[glhd/special

1929.4k](/packages/glhd-special)[bjuppa/laravel-blog

Add blog functionality to your Laravel project

483.3k2](/packages/bjuppa-laravel-blog)

PHPackages © 2026

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