PHPackages                             kilobyteno/laravel-user-guest-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. kilobyteno/laravel-user-guest-like

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

kilobyteno/laravel-user-guest-like
==================================

A Laravel package to allow guests and users to like models

1.5.0(2mo ago)5929MITPHPPHP ^8.2CI passing

Since Mar 24Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/kilobyteno/laravel-user-guest-like)[ Packagist](https://packagist.org/packages/kilobyteno/laravel-user-guest-like)[ Docs](https://github.com/kilobyteno/laravel-user-guest-like)[ GitHub Sponsors](https://github.com/danielrtrd)[ RSS](/packages/kilobyteno-laravel-user-guest-like/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (10)Dependencies (16)Versions (11)Used By (0)

Laravel User Guest Like
=======================

[](#laravel-user-guest-like)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c7e21a8091b987601bb5f93c8d6ae3104dfa5f36a3db0a3a6151bb1170405a28/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b696c6f627974656e6f2f6c61726176656c2d757365722d67756573742d6c696b652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kilobyteno/laravel-user-guest-like)[![Total Downloads](https://camo.githubusercontent.com/d0e92b5ab93d2c68f19bec71e07f409ec014f3790360ac51124d651488486002/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b696c6f627974656e6f2f6c61726176656c2d757365722d67756573742d6c696b652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kilobyteno/laravel-user-guest-like)[![Tests](https://github.com/kilobyteno/laravel-user-guest-like/actions/workflows/run-tests.yml/badge.svg)](https://github.com/kilobyteno/laravel-user-guest-like/actions/workflows/run-tests.yml)

A Laravel package to allow guests and users to like models.

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

[](#installation)

You can install the package via composer:

```
composer require kilobyteno/laravel-user-guest-like
```

Publish the package:

```
php artisan vendor:publish --provider="Kilobyteno\LaravelUserGuestLike\LaravelUserGuestLikeServiceProvider"
```

Or you can publish manually:

```
php artisan vendor:publish --tag="user-guest-like-config"
php artisan vendor:publish --tag="user-guest-like-migrations"
php artisan migrate
```

The content of the config file that will be published to `config/user-guest-like.php`:

```
return [

    // Let guests like a model
    'guest_like_enabled' => true,

    // Save IP and user agent to database
    'user_tracking_enabled' => false,

];
```

Usage
-----

[](#usage)

Add the `HasUserGuestLike` trait to the model:

```
use Kilobyteno\LaravelUserGuestLike\Traits\HasUserGuestLike;
use Illuminate\Database\Eloquent\Model;

class EloquentModel extends Model
{
    use HasUserGuestLike;
}
```

Like a model as user (or guest):

```
$user = auth()->check() ? auth()->user() : null;
// Passing the user as null will like as a guest (if enabled)
$model->like($user);
```

Dislike a model as user (or guest):

```
$user = auth()->check() ? auth()->user() : null;
// Passing the user as null will like as a guest (if enabled)
$model->dislike($user);
```

Check if a user has liked a model (or guest has liked a model):

```
$user = auth()->check() ? auth()->user() : null;
// Passing the user as null will check if the guest (if enabled) has liked the model
if($model->hasLiked($user)) {
    // User has liked the model
}
```

Display the number of likes for a model:

```
$model->likes()->count();
```

Testing
-------

[](#testing)

```
composer test
```

Compatibility
-------------

[](#compatibility)

1.01.11.21.31.41.58.x✅❌❌❌❌❌9.x❌✅✅❌❌❌10.x❌❌✅✅❌❌11.x❌❌❌✅✅❌12.x❌❌❌❌✅✅13.x❌❌❌❌❌✅Changelog
---------

[](#changelog)

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

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

[](#contributing)

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

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Kilobyte AS](https://github.com/kilobyteno)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance85

Actively maintained with recent releases

Popularity22

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 52.9% 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 ~163 days

Recently: every ~299 days

Total

10

Last Release

87d ago

Major Versions

0.0.4 → 1.0.02022-04-28

PHP version history (2 changes)0.0.1PHP ^8.0

1.5.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/beb57b0e8e8671030fc19c7b49893b2e2b143924252c2645539a01cdd272f51a?d=identicon)[DanielRTRD](/maintainers/DanielRTRD)

---

Top Contributors

[![dsbilling](https://avatars.githubusercontent.com/u/9788214?v=4)](https://github.com/dsbilling "dsbilling (55 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (30 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (19 commits)")

---

Tags

eloquentguestlaravellaravel-packagelikephpuserlaraveluserlikeguestkilobytenokilobyte

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/kilobyteno-laravel-user-guest-like/health.svg)

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

###  Alternatives

[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.3M42](/packages/spatie-laravel-pdf)[wnx/laravel-backup-restore

A package to restore database backups made with spatie/laravel-backup.

213389.8k2](/packages/wnx-laravel-backup-restore)[spatie/laravel-model-flags

Add flags to Eloquent models

4471.2M4](/packages/spatie-laravel-model-flags)[clickbar/laravel-magellan

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

438834.4k1](/packages/clickbar-laravel-magellan)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3913.7k](/packages/rawilk-profile-filament-plugin)[lacodix/laravel-model-filter

A Laravel package to filter, search and sort models with ease while fetching from database.

17555.1k](/packages/lacodix-laravel-model-filter)

PHPackages © 2026

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