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

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

manzadey/laravel-like
=====================

Allows Laravel Eloquent models to implement a 'like'

v1.1.0(3y ago)018MITPHPPHP ^8.0|^8.1

Since Apr 19Pushed 3y ago1 watchersCompare

[ Source](https://github.com/Manzadey/laravel-like)[ Packagist](https://packagist.org/packages/manzadey/laravel-like)[ RSS](/packages/manzadey-laravel-like/feed)WikiDiscussions 1.x Synced 1mo ago

READMEChangelogDependencies (4)Versions (3)Used By (0)

Laravel Like package
====================

[](#laravel-like-package)

[![Latest Version on Packagist](https://camo.githubusercontent.com/4d3d192b5f37310509b9d79e8f1a7359edda66bb7f8a5f100056eccf13e21f8a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d616e7a616465792f6c61726176656c2d6c696b652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/manzadey/laravel-like)[![Total Downloads](https://camo.githubusercontent.com/641cc62e69fe3a6b78d057357459fe87d88722aa0db2053876afaafdc94e4d22/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d616e7a616465792f6c61726176656c2d6c696b652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/manzadey/laravel-like)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

This package implements the likes/dislikes system in the laravel framework.

Index
-----

[](#index)

- [Installation](#installation)
- [Models](#models)
- [Usage](#usage)

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

[](#installation)

You can install the package via composer:

1. Install the package via Composer

```
composer require manzadey/laravel-like
```

2. Publish the database from the command line:

```
php artisan vendor:publish --provider="Manzadey\LaravelLike\LikeServiceProvider"
```

3. Migrate the database from the command line:

```
php artisan migrate
```

Publishing the config file
--------------------------

[](#publishing-the-config-file)

Publishing the config file is optional:

```
php artisan vendor:publish --provider="Manzadey\LaravelLike\LikeServiceProvider" --tag="config"
```

Models
------

[](#models)

Your User model should import the `Likeability` trait, `LikeabilityContract` implements interface and use it, that trait allows the user to like the models. (see an example below):

```
use Manzadey\LaravelLike\Traits\Likeability;
use Manzadey\LaravelLike\Contracts\LikeabilityContract;

class User extends Authenticatable implements LikeabilityContract;
{
	use Likeability;
}
```

Your models should import the `Likeable` trait, `LikeableContract` implements interface and use it, that trait has the methods that you'll use to allow the model be likeable. In all the examples I will use the Post model as the model that is 'Likeable', that's for example proposes only. (see an example below):

```
use Manzadey\LaravelLike\Traits\Likeable;
use Manzadey\LaravelLike\Contracts\LikeableContract;

class Post extends Model implements LikeableContract
{
    use Likeable;
}
```

That's it ... your model is now **"likeable"**! Now the User can favorite models that have the favoriteable trait.

Usage
-----

[](#usage)

### A standard set of methods for working with the package:

[](#a-standard-set-of-methods-for-working-with-the-package)

```
$article = \App\Models\Article::first();
$user = \App\Models\User::first();

$article->like($user); // Add the current model to like of the specified user
$article->dislike($user); // Add the current model to dislike of the specified user
$article->toggleLike($user); // The switch of the likes of the specified user
$article->removeLikeable($user); // Delete the current module from the likes of the specified user
$article->isLike($user); // Check the current model whether it is a likes of the specified user
$article->isDislike($user); // Check the current model whether it is a likes of the specified user
```

*You can also use these methods as a `Likeability' model.*

### Checking the model for the presence of likes/dislikes of a particular user

[](#checking-the-model-for-the-presence-of-likesdislikes-of-a-particular-user)

```
$article = \App\Models\Article::first();
$user = \App\Models\User::first();

$article->isLike($user);
$article->isDislike($user);
```

*You can also use these methods as a `Likeability' model.*

### Check the current model, whether it is marked with a like/dislike

[](#check-the-current-model-whether-it-is-marked-with-a-likedislike)

```
$article = \App\Models\Article::first();

$article->isLikes();
$article->isDislikes();
```

### Returns a collection of users who have liked/disliked this model

[](#returns-a-collection-of-users-who-have-likeddisliked-this-model)

```
$article = \App\Models\Article::first();
$user = \App\Models\User::first();

$article->likeBy();
$article->dislikeBy();
```

### We get a collection of models marked with a like/dislike

[](#we-get-a-collection-of-models-marked-with-a-likedislike)

```
$article = \App\Models\Article::first();
$user = \App\Models\User::first();

$user->getLike();
$user->getDisike();

// With usage models
$user->getLike([\App\Models\Article::class]);
$user->getDisike([\App\Models\Article::class]);
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

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

Credits
-------

[](#credits)

- [Andrey Manzadey](https://github.com/manzadey)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

Laravel Package Boilerplate
---------------------------

[](#laravel-package-boilerplate)

This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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 ~17 days

Total

3

Last Release

1450d ago

### Community

Maintainers

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

---

Top Contributors

[![Manzadey](https://avatars.githubusercontent.com/u/34869211?v=4)](https://github.com/Manzadey "Manzadey (6 commits)")

---

Tags

laravellikedislikelaravel-likeManzadey

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[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)[qirolab/laravel-reactions

Implement reactions (like, dislike, love, emotion etc) on Laravel Eloquent models.

19564.6k](/packages/qirolab-laravel-reactions)[clickbar/laravel-magellan

This package provides functionality for working with the postgis extension in Laravel.

423715.4k1](/packages/clickbar-laravel-magellan)[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)
