PHPackages                             inpin/lara-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. inpin/lara-like

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

inpin/lara-like
===============

Add Likeable trait to Laravel Eloquent models

1.0.4(7y ago)59381MITPHPPHP &gt;=7.0

Since Oct 18Pushed 7y ago1 watchersCompare

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

READMEChangelog (5)Dependencies (8)Versions (6)Used By (0)

LaraLike
========

[](#laralike)

Important note: this product is forked and edited from base [laravel-likeable](https://github.com/rtconner/laravel-likeable) package.

[![Build Status](https://camo.githubusercontent.com/582555f075d2fbf103f96fff580c0f13568a50184983a3048a8a5e97a56b33d5/68747470733a2f2f7472617669732d63692e6f72672f696e70696e2f6c6172612d6c696b652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/inpin/lara-like)[![StyleCI](https://camo.githubusercontent.com/860810fe37d091b2d95de9cdef03d41f43842e67730317ca39c004e17e671727/68747470733a2f2f7374796c6563692e696f2f7265706f732f3130373339353034342f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/107395044)[![Maintainability](https://camo.githubusercontent.com/247b479af4901e77c66615155a1ef97031e703095721e213f6041f7d1223e49c/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f31323833636438373462663836393937376564662f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/inpin/lara-like/maintainability)[![Latest Stable Version](https://camo.githubusercontent.com/0330f070a60cb40495c233447ab26739f2dc1bcbaca4770ec67e5c3a8da174a3/68747470733a2f2f706f7365722e707567782e6f72672f696e70696e2f6c6172612d6c696b652f762f737461626c65)](https://packagist.org/packages/inpin/lara-like)[![Total Downloads](https://camo.githubusercontent.com/6516a6ea0f751783bc0376a3b9ec8b1dbf41f66db524bd975d0ecae4f23a56f0/68747470733a2f2f706f7365722e707567782e6f72672f696e70696e2f6c6172612d6c696b652f646f776e6c6f616473)](https://packagist.org/packages/inpin/lara-like)[![Latest Unstable Version](https://camo.githubusercontent.com/027253403487058c46d035507200860f3251598215eddabb462e5ba62be3ace9/68747470733a2f2f706f7365722e707567782e6f72672f696e70696e2f6c6172612d6c696b652f762f756e737461626c65)](https://packagist.org/packages/inpin/lara-like)[![License](https://camo.githubusercontent.com/8c83ec7029db3ff1354e614c9556ff2fc4dd6b1f7842eb27646f1008a4a63b50/68747470733a2f2f706f7365722e707567782e6f72672f696e70696e2f6c6172612d6c696b652f6c6963656e7365)](https://packagist.org/packages/inpin/lara-like)

Trait for Laravel Eloquent models to allow easy implementation of a "like" or "favorite" or "remember" or what ever you want features.

#### Composer Install (for Laravel 5.5 and above)

[](#composer-install-for-laravel-55-and-above)

```
composer require inpin/lara-like

```

#### Install and then run the migrations

[](#install-and-then-run-the-migrations)

```
'providers' => [
    \Inpin\LaraLike\LaraLikeServiceProvider::class,
],
```

```
php artisan vendor:publish --provider="Inpin\LaraLike\LaraLikeServiceProvider" --tag=migrations
php artisan migrate
```

#### Setup your models

[](#setup-your-models)

```
class Book extends \Illuminate\Database\Eloquent\Model {
    use Inpin\LaraLike\Likeable;
}
```

#### Sample Usage

[](#sample-usage)

```
$book->like(); // like the book for current user
$book->like($user); // pass in your own user
$book->like(0); // just add likes to the count, and don't track by user
$book->like('api'); // like the book for current user with guard 'api'
$book->like(null, 'bookmark') // add book for current user to bookmarks
$book->like($user, 'bookmark') // pass user and type

$book->unlike(); // remove like from the book
$book->unlike($user); // pass in your own user id
$book->unlike(0); // remove likes from the count -- does not check for user
$book->unlike('api'); // remove like from book for current user with guard 'api'
$book->unlike(null, 'bookmark') // remove current book from current user bookmarks
$book->unlike($user, 'bookmark') // pass user and type

$book->likes; // Iterable Illuminate\Database\Eloquent\Collection of existing likes
$book->likes()->where('type', 'bookmark')

$book->liked(); // check if currently logged in user liked the book
$book->liked($myUserId);

$book->likeCount($type); // determine number of likes for given $type (default type is 'like')

Article::whereLikedBy($myUserId) // find only books where user liked them
	->with('likeCounter') // highly suggested to allow eager load
	->get();
```

note: default type is 'like'.

#### Credits

[](#credits)

- Mohammad Nourinik -

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity62

Established project with proven stability

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

Total

5

Last Release

2895d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/83b1e9074067bce11d6d2c783c057677dc8542e51dbd068e532b9f28cb0dc166?d=identicon)[enourinick](/maintainers/enourinick)

---

Top Contributors

[![enourinick](https://avatars.githubusercontent.com/u/17546136?v=4)](https://github.com/enourinick "enourinick (3 commits)")

---

Tags

bookmarkcomposereloquentfavoritelaralikelaravellikelikeablemodelpackageseentraitlaraveleloquenttraitlaravel5likerememberFollowfavoritelikeablelikablefavourite

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/inpin-lara-like/health.svg)

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

###  Alternatives

[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)[cybercog/laravel-love

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

1.2k302.7k1](/packages/cybercog-laravel-love)[watson/rememberable

Query caching for Laravel

1.1k5.2M13](/packages/watson-rememberable)[cybercog/laravel-ban

Laravel Ban simplify blocking and banning Eloquent models.

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

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

19564.6k](/packages/qirolab-laravel-reactions)[cybercog/laravel-ownership

Laravel Ownership simplify management of Eloquent model's owner.

9126.6k3](/packages/cybercog-laravel-ownership)

PHPackages © 2026

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