cslant/laravel-like
A Laravel package that adds like and favorite behavior to Eloquent models. Use traits and polymorphic relationships to like, unlike, toggle, count, and query liked items with minimal setup and clean syntax.
Like and Love facades, so a squad can add reactions (like/dislike/love, undo variants, and toggle) to existing Eloquent models with a facade call or a trait method rather than designing a new interaction schema. That shortens the path from "engagement experiment" to "in a sprint."unDislike, unlove, toggle) maps cleanly to common product stories: upvote/downvote on community content, wishlist-style "love" on catalog items, reaction toggles on feeds, and reversible moderation actions. PMs can spec these as thin features instead of platform work.like.interaction_model and like.users.model means environment-specific configuration is less likely to fail silently — relevant for teams running multiple environments or multi-tenant setups.Consider adoption when:
Look elsewhere (or plan for in-house work) when:
LoveScope → LoveScopes rename is a small but real signal that internal trait names are not a stable contract; direct extension of internals carries upgrade cost.Before committing, the PM should ask engineering for: index and query plans on the interaction table, current package maintenance activity and release cadence, an upgrade path from v2.0.0 (the trait rename), and whether existing user-interaction data needs a migration.
To executives: This is a small, focused Laravel package that lets us add "like," "love," and "dislike" reactions to any content type using tested, reusable code instead of building it ourselves. Version 2.1.0 is a genuine maturity step: it adds a clean service-and-facade interface, fixes a configuration bug that could have broken setups across environments, and — most importantly — ships an automated test suite. That combination lowers delivery risk and lets us run engagement experiments in days rather than weeks. Cost is a single dependency on a non-differentiating capability; the risk is manageable provided engineering confirms it handles our expected read volume, since the package does not appear to include built-in counting or ranking.
To engineering: The API is deliberately thin — a LikeManager service, Like/Love facades covering like, dislike, love, unlike, unlove, unDislike, and toggle, plus HasLike/HasLove traits for interactable models. Two things to note on upgrade: the LoveScope trait is renamed to LoveScopes (treat as a patch-level break if you extend it), and forgetInteractions* is now deduplicated into a shared ForgetsInteractions trait. Config fallback for like.interaction_model and like.users.model is fixed, so re-verify any environment overrides. Outstanding technical diligence: index strategy and query cost on interaction lookups, whether counts are your responsibility, and polymorphic coverage for our model set.
How can I help you explore Laravel packages today?