Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Like Laravel Package

laravel-interaction/like

A Laravel package for adding like and unlike interactions to your Eloquent models. Use a simple trait to let users like any model, toggle likes, check status, and query like counts with ease.

View on GitHub
Deep Wiki
Context7

💗 User like/unlike behaviour for Laravel.

Frequently asked questions about Like
How do I install laravel-interaction/like in a Laravel app?
Install it with Composer using composer require laravel-interaction/like. Laravel package auto-discovery should register the service provider, then you publish and run the package migrations and apply the provided trait to your interacting model. Because 1.0.0 is the first stable tag, read the release notes and composer.json before pinning it in a production app.
Which PHP and Laravel versions does laravel-interaction/like support?
The exact PHP, Laravel, and database support ranges are not included in the supplied overview, so verify them in the package composer.json at the 1.0.0 tag. Compare those constraints with your platform's pinned PHP and Laravel versions before adoption. Database driver support matters because polymorphic indexes and uniqueness constraints behave differently across MySQL, PostgreSQL, and SQLite.
How do I let my User model like other Eloquent models?
Add the package's interaction trait to the model that performs the likes, typically your User model. The liked side can be any Eloquent model because the package uses polymorphic relationships rather than requiring a trait on every likeable model. Check the README for the exact trait namespace and any required contracts or configuration.
How do I toggle a like or check whether a model is already liked?
The package is designed around simple like, unlike, toggle, and status-check methods on the interacting model. Exact method names and return values should be confirmed in the README for 1.0.0 before wiring them into controllers or Blade views. If toggling also updates counters, wrap the operation in a transaction or queued job to keep state consistent.
Does laravel-interaction/like prevent duplicate likes at the database level?
Application-level checks alone are not sufficient for one like per user per subject; the shipped migration should include a unique composite index across the actor and polymorphic columns. Verify that constraint in the migration before production, especially with concurrent double-submits and retried jobs. Adding a unique index after the interactions table is large can require a lock-heavy migration.
Does the package maintain a likes_count column on liked models?
The overview mentions querying like counts, but it does not confirm whether denormalised counter columns are maintained automatically. Inspect the migration and model code to see whether counters are updated transactionally, through queued events, or not at all. If counters are not provided, use withCount for reads or maintain your own counters with a reconciliation strategy.
How do I avoid N+1 queries when checking likes across a feed?
Checking whether the current user liked each item one by one is a classic N+1 problem on feeds and listings. Preload the current user's likes for the page's model type and IDs in a single query, then build an in-memory set of liked IDs for rendering. Confirm whether the package ships eager-loading helpers or a preloaded state map before assuming that support exists.
Is laravel-interaction/like production-ready at version 1.0.0?
Version 1.0.0 is the first tagged stable release and establishes a baseline rather than proving long-term production hardening. A stable tag signals API intent, but you should still review the changelog, issue history, test coverage, and security disclosure process. Budget for early-adopter risk and pin the version until you have validated it under your workload.
How should I handle GDPR erasure and orphaned likes?
Interaction rows are user-linked personal data, so include them in account deletion, export, and erasure workflows. Add cascade deletes or cleanup jobs for deleted users, and decide deliberately how soft-deleted or force-deleted liked models should leave orphaned polymorphic rows. Verify the package's documented stance rather than assuming it handles lifecycle cleanup for you.
What are alternatives to laravel-interaction/like?
Alternatives include cybercog/laravel-love, rtconner/laravel-likeable, or a custom polymorphic interactions table when you need reactions, bookmarks, follows, or analytics events. Choose this package if you want a small trait-based like and unlike layer and are comfortable evaluating a young 1.0.0 release. If engagement tracking is primarily product analytics, consider emitting events to a pipeline instead of storing high-volume interaction rows in your application database.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource